Uploads complete but permissions wrong (403)
Permalink 2 users found helpful
Hi all
I can upload files to my server using the file manager, but they aren't inheriting the correct permissions.
I've chmodded my files/ folder recursively to both 755 and 777, but any newly uploaded files don't appear when I insert them (I just get the alt text) and if I try to access them directly I get a 403 error. The only way to make them work is to manually re-chmod the files/ directory (or the files themselves) to 755/777.
Any idea why this might be happening? I've seen a couple of similar problems on the forum but none of the solutions has worked for me.
Any help would be much appreciated!
PS my phpinfo() can be see here:
http://r33769.ovh.net/~scotlawc/info.php...
And I'm running 5.4.0.5 :)
I can upload files to my server using the file manager, but they aren't inheriting the correct permissions.
I've chmodded my files/ folder recursively to both 755 and 777, but any newly uploaded files don't appear when I insert them (I just get the alt text) and if I try to access them directly I get a 403 error. The only way to make them work is to manually re-chmod the files/ directory (or the files themselves) to 755/777.
Any idea why this might be happening? I've seen a couple of similar problems on the forum but none of the solutions has worked for me.
Any help would be much appreciated!
PS my phpinfo() can be see here:
http://r33769.ovh.net/~scotlawc/info.php...
And I'm running 5.4.0.5 :)
What owner, group and permissions do the newly uploaded files get prior to you having to chmod them? What owner, group and permissions are on the /files folder?
Thanks for the reply.
Here's the output of ls -l:
drwxrwxrwx 19 scotlawc users 4096 2010-05-27 12:51 files
and when I upload a file, it gets these permissions (before I chmod):
-rw-r--r-- 1 scotlawc users 9309 2010-05-27 15:13 homepage.png
Any thoughts?
Here's the output of ls -l:
drwxrwxrwx 19 scotlawc users 4096 2010-05-27 12:51 files
and when I upload a file, it gets these permissions (before I chmod):
-rw-r--r-- 1 scotlawc users 9309 2010-05-27 15:13 homepage.png
Any thoughts?
Look in the filemanager under the "Access" tab. Is the Guest set to "Yes"? Are you using the filemanager assigned URL to acces the files (likehttp://www.mysite.com/file/1612/7256/1610/filename.png)?... This URL can be found in the file properties in the filemanager.
Guest is set to 'yes'.
I can't access the files directly via their URL - I get a 403 :(
When I try to view them in the filemanager, it's blank. Also, no thumbnails are generated (probably because c5 can't access the files to do it).
I can't access the files directly via their URL - I get a 403 :(
When I try to view them in the filemanager, it's blank. Also, no thumbnails are generated (probably because c5 can't access the files to do it).
In that same access tab, where is the "standard File Location" pointing to? Also, check the Alternate Storage Directory.
The standard location is set to where I would expect it to be i.e. /home/username/www/files
There's nothing set in the alternative location fields.
There's nothing set in the alternative location fields.
And when you chmod the files the filemanager loves them ( you get thumbnails, can edit, etc...) and the direct URL works fine.
@nteaviation
That's right.. once I've chmodded them, everything works as it should.
That's right.. once I've chmodded them, everything works as it should.
Wow, this is wierd. Are there any .htaccess settings getting in your way? What user does your webserver process run as? I'm starting to run out of things to look at :(
Here's the output of 'ps -FA | grep apache'
I'm not sure what that means.
I've emptied .htaccess (it just had the c5 url-rewriting stuff in it) but that didn't help.
root 31733 1 0 1730 2896 1 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31738 31733 0 1764 2344 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31739 31733 0 1783 2492 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31740 31733 0 1764 2292 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31741 31733 0 1764 2340 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31747 31733 0 1777 2432 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31754 31733 0 1843 2592 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31755 31733 0 1777 2432 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31756 31733 0 1775 2440 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31757 31733 0 1764 2292 0 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start nobody 31769 31733 0 1730 1804 1 22:50 ? 00:00:00 /usr/local/apache/bin/httpd -D SSL -k start root 32154 31402 0 442 708 1 22:54 pts/0 00:00:00 grep --colour=auto apache
I'm not sure what that means.
I've emptied .htaccess (it just had the c5 url-rewriting stuff in it) but that didn't help.
I'm with nteaviation, that it's probably that the apache process is on a different user/group, but because it looks like even if it is, it should still be able to read with the permissions you have set for world (read)... That said though, if it turns out that it isn't it.....
It makes me think that maybe you have all file paths set to run through the CGI wrapper, and so the issue is coming from the fact that the execute flag isn't set...
So I guess that's my question: do you have apache processing all urls through php/cgi? What happens if you set it to manually to 700, how about 070?
It makes me think that maybe you have all file paths set to run through the CGI wrapper, and so the issue is coming from the fact that the execute flag isn't set...
So I guess that's my question: do you have apache processing all urls through php/cgi? What happens if you set it to manually to 700, how about 070?
I'm not sure.. does the phpinfo link in my first post tell you this? I don't know how to check.
At this point (given that the read flag is set, and it seems to be activating the execute flag is what solves the problem), my gut is telling me that your probably running some form of suPHP and that the issue is with the default umask set for php upload scripts...
Do you have access to a server config file called suphp.conf? It's normally buried in /usr/local/etc/suphp.conf or /etc/suphp.conf
If yes look for a line says:
umask=0133 and change it to
umask=0022
if you can find that line, then restart apache (apachectl restart), and hopefully all will be solved...
Do you have access to a server config file called suphp.conf? It's normally buried in /usr/local/etc/suphp.conf or /etc/suphp.conf
If yes look for a line says:
umask=0133 and change it to
umask=0022
if you can find that line, then restart apache (apachectl restart), and hopefully all will be solved...
That worked!!
umask was set to 0033 not 0133, but I changed it to 0022 anyway and that did the trick. Many thanks :)
umask was set to 0033 not 0133, but I changed it to 0022 anyway and that did the trick. Many thanks :)