I've created a directory as root, but when I try to change ownership if it, it won't change! I have no idea why. (I've snipped the results of ls -halg
for brevity, in case you're wondering why some files are missing...)
root@localhost:/opt/tomcat/conf# mkdir Catalina
root@localhost:/opt/tomcat/conf# ls -halg
total 244K
drwxr-x--- 3 tomcat 4.0K May 12 17:09 .
drwxr-xr-x 9 tomcat 4.0K May 10 02:34 ..
drwxr-xr-x 2 root 4.0K May 12 17:09 Catalina
-rw-r----- 1 tomcat 13K May 12 15:32 catalina.policy
-rw-r----- 1 tomcat 7.1K Mar 30 10:29 catalina.properties
root@localhost:/opt/tomcat/conf# chown tomcat Catalina
root@localhost:/opt/tomcat/conf# ls -halg
total 244K
drwxr-x--- 3 tomcat 4.0K May 12 17:09 .
drwxr-xr-x 9 tomcat 4.0K May 10 02:34 ..
drwxr-xr-x 2 root 4.0K May 12 17:09 Catalina
-rw-r----- 1 tomcat 13K May 12 15:32 catalina.policy
-rw-r----- 1 tomcat 7.1K Mar 30 10:29 catalina.properties
root@localhost:/opt/tomcat/conf#
When I made the tomcat directory yesterday, it was happy to chown -R /opt/tomcat
everything to the tomcat user like it should. I'm really at a loss at why such a simple command fails.
On the one hand:
chown
with a simple user parameter, not including the separator:
(or obsolete.
) changes the user ownership of further given file(s) and leaves the group ownership of the file(s) unchanged.On the other hand:
ls -halg
displays only the group ownership of a file in its output because of the included option-g
.Thus changing only the user, which worked (no error was displayed) didn't change the result of
ls -halg
.ls -hal
should have been used here to see the change.