Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

Your Answer


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.