Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I moved a file from another server to my server. in directory listing Apache doesn't show it and I cant download it from browser (forbidden) but I created a new file and chmod + chown both of them to the same thing and the one I created can be accessed but I still can't download the file moved from another server.

How can I fix this?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You need to check SELinux properties.

ls -Z or ls --scontext will show you the properties.

You the need to change the security settings using chcon to their appropriate values.

Or you can just change the security properties on the file to the same ones as the file you created by using the following chcon command:
chcon --reference file_to_copy_from file_to_copy_to

For more information on CentOS and SELinux, look HERE.

share|improve this answer
    
Thanks, I disabled SELinux, and no change. I didn't understand how to fix this with chcon I have a file named test.tar that I can't acess it due forbidden error. ls -Z result: -rw-r--r-- user user root:object_r:user_home_t test.tar –  Zim3r Jul 28 '12 at 20:07
add comment

Thanks to nojak,

I fixed it with this command: restorecon -v test.tar

share|improve this answer
    
Glad to hear it! –  nojak Jul 28 '12 at 21:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.