permissions problem

Kakumba

Senior member
Mar 13, 2006
610
0
0
Got an odd situation. I had to copy some files from a share accessible to my windows machine onto my Linux server. Now, these files are not accessible to apache, even if I set them to 777. I had the same files before, but someone deleted them, so I restored from the windows share. before they had been on the share, everything was fine, so it seems that windows has corrupted the permissions.

Can anyone tell me how to clear the windows permissions, and re-apply the linux ones?
 

QuixoticOne

Golden Member
Nov 4, 2005
1,855
0
0
You didn't say what LINUX you run or what owner/group the files should belong to for your apache installation, or the SELINUX security context needed for it if any, but taking a guess....

chown -R apache:apache /somewhere
chcon -R -h -t httpd_sys_content_t /somewhere
find /somewhere -type d -print0 | xargs -0 chmod 775
find /somewhere -type f -print0 | xargs -0 chmod 774

rm -rf /Microsoft/Windows (j/k sort of...)

http://www.linuxhomenetworking..._The_Apache_Web_Server
http://www.networkclue.com/os/Linux/commands/chcon.aspx
http://www.networkclue.com/internet/HTTP/Apache/
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
Sorry. Ok, SELinux is disabled (internal facing web server, SELinux is just annoying in this case). OS in question is Fedora 9.

Files are owned by user apache, group doesnt matter. had done a chmod -R 755 * on the directory, that didnt help. tried you commands, without the chcon, and still no luck. Apache is finding the files ok, but is determined that we do not have permission to read it.
 

QuixoticOne

Golden Member
Nov 4, 2005
1,855
0
0
Check:
/etc/httpd/conf/httpd.conf


#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf


#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

Verify that you're not MISSING a critical .htaccess file or similar; since the name BEGINS with a "." "windows" would typically "hide" it and maybe you did not copy / restore it or a similar file?
http://httpd.apache.org/docs/1.3/howto/htaccess.html

Try restarting the apache server:
/etc/init.d/httpd restart

Verify that you're REALLY not using SELINUX:
# getenforce
Enforcing

# selinuxenabled && echo ENABLED

It never hurts to chcon things correctly...
# ls -Za /var/www/html/
drwxr-xr-x root root system_u:eek:bject_r:httpd_sys_content_t:s0 .
drwxr-xr-x root root system_u:eek:bject_r:httpd_sys_content_t:s0 ..

 

Kakumba

Senior member
Mar 13, 2006
610
0
0
Sorry, got it solved. Re-transferred the files, and for some reason it works this time. Well, I don't know what happened, or why it now works, but at this point, I'm willing to just accept that it works.