September 28, 2015
Posted by on
I uploaded a file to the server but the file can’t be accessed from the website. I checked the permission and ownership they all look fine. Until I use ls-Z to check the file context, it shows me the problem: The filed was uploaded to a different folder first, so it retains the original type after I moving it the public folder. ll comand wouldn’t show the type details, we will have to use ls -Z and then use chcon command to change it.
November 28, 2012
Posted by on
What happens here is that I scped the file to server under my home directory, and then move it directly to the css folder. even I changed
the owner and permission, I keep getting permission error.
use command: ll, showing something like this:
-rwxr-xr-x 1 apache apache 69345 Nov 29 09:50 1place.css
-rwxr-xr-x 1 apache apache 2897 Nov 14 12:14 1place-framework.css
use command : ls -alZ
-rwxr-xr-x apache apache root:object_r:httpd_sys_content_t alert.css
-rwxr-xr-x apache apache user_u:object_r:httpd_sys_content_t alternate.css
we could see some files have a different value for sllinux from others. it points to my user account rather than the system one.
then we need to run command to fix it:
sudo restorecon *
another solution is to copy the file to a folder under var, and then move the file from the new folder to under css.