2

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?

2 Answers 2

1

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.

1
  • 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, 2012 at 20:07
0

Thanks to nojak,

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

1
  • Glad to hear it! Jul 28, 2012 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .