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?
You need to check SELinux properties.
ls -Z
orls --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.
Thanks to nojak,
I fixed it with this command:
restorecon -v test.tar