Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-05-07 08:02:01

ephi
New Member
Registered: 2007-04-23
Posts: 7

image and file folders chmod 755

My host doesn’t allow chmod 777 and the least they can give is 755, is there a tweak or plug in that I can use to make file/image uploading work? I have searched the forum but didn’t found anything suitable for my need.

Offline

#2 2007-05-07 09:27:21

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: image and file folders chmod 755

755 should be enough in most cases.
Do you get an error when uploading images/files?
Please post your full Textpattern diagnostics.

Offline

#3 2007-05-07 19:44:55

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: image and file folders chmod 755

At a guess php is served via an apache module and hence runs as the apache server user “nobody”. This configuration requries a user account directory be 777 to permit php to write to it.

The alternative is to have pgp run as a process (eg fast-cgi) and then it can run under the user’s permissions and write to a 755 directory. There are good points and bad to both. The actual solution will depend on your host.


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#4 2007-05-08 05:52:50

ephi
New Member
Registered: 2007-04-23
Posts: 7

Re: image and file folders chmod 755

ruud: I didn’t get any error when uploading, because there was no uploading form until I change those folders permission to 777. :D

This was the warning that appears instead of the uploading form:
Warning: cannot write to image directory
/images/.
Please change file permissions to 777.

the server is Apache run under Debian. Need more info?

NyteOwl: Can you explain that in English? :D And please also list both bad and good points to both solutions. And let’s just say my server admin is not anymore smarter than I do. In the past, I have to write a tutorial for him to change the Apache config file in order to enable custom 404.

Offline

#5 2007-05-08 11:38:31

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: image and file folders chmod 755

If you server admin is as smart as you say he is, then you may want to consider switching to a different webhost. Otherwise, try googling for: php + suexec, php + fast-cgi, vps (virtual private server). There’s plenty information on this subject to be found. Add the keyword Debian to the query and you may even find a complete tutorial ;)

Last edited by ruud (2007-05-08 11:39:06)

Offline

#6 2007-05-09 07:55:35

ephi
New Member
Registered: 2007-04-23
Posts: 7

Re: image and file folders chmod 755

Hahaha, I cannot change the webhost, it’s a university site. They host the files themselves. ;-)
Actually the 755 rule is from me, and I don’t want to break my own rule. :D
Thanks for the keywords, I’ll try my Google-fu.

Last edited by ephi (2007-05-09 07:57:25)

Offline

#7 2007-05-09 22:28:42

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: image and file folders chmod 755

I don’t think 755 will work at all on most servers. The directory must be writable by the PHP process. Typically PHP runs as ‘nobody’, so it’s necessary to use 777 (or 757 or 767) – i.e. world writable.


Alex

Offline

#8 2007-05-09 23:11:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: image and file folders chmod 755

Unless you’re totally isolated from other users on such a server (assuming you’re sharing it with others), that doesn’t sound very safe.

Offline

#9 2007-05-10 00:55:31

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: image and file folders chmod 755

Them’s the breaks, I’m afraid, it’s a well-known limitation of PHP.

Offline

#10 2007-05-10 01:29:28

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: image and file folders chmod 755

Some hosts provide a more secure environment, such as Textdrive’s fastcgi PHP.

As Mary says, on many servers there is no alternative: either use 777, or forget about file and image uploads.


Alex

Offline

#11 2007-05-10 06:31:47

ephi
New Member
Registered: 2007-04-23
Posts: 7

Re: image and file folders chmod 755

Thanks for all your inputs.

ruud: yes, it’s a shared server. I know I can access other people’s directory, so I’m sure some login out there can access mine, and I don’t want them to caught the 777 folders.

Offline

#12 2007-05-10 06:50:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: image and file folders chmod 755

I think it would be nice if textpattern explicitly stated that 777 is less secure, when giving the advise to use 777. Although it’s not the responsibility of TXP, using more secure hosting is in everyone’s best interest.

BTW, I suspect that 733 permissions (rwx -wx -wx) or perhaps even 703 or 730 permissions are enough in this situation. Because you don’t need read access to the directory itself unless you need a directory listing (or when using multiviews). For files that you know exist, execute permission on the directory is enough (and write to be able to create files). The files themselves must of course still have read permissions set (644 by default).

Last edited by ruud (2007-05-10 06:59:45)

Offline

Board footer

Powered by FluxBB