[CentOS] Web server files ownership?

John Hodrien J.H.Hodrien at leeds.ac.uk
Fri Jul 7 11:56:34 UTC 2017


On Fri, 7 Jul 2017, Pete Biggs wrote:

> Not necessarily. In order to change permissions on a file you need to
> have write access to the directory (i.e. the special file in the parent
> directory that describes the files present in the directory).

To delete, yes, but to chmod?  It makes no sense for that to be the case, as
hardlinks would end up being a touch baffling.

[ as root ]
# mkdir foo
# touch foo/bar
# chown user foo/bar
# chmod 574 foo/bar

[ as user ]
$ cd foo
$ ls -ld .
drwxr-xr-x. 2 root root 16 Jul  7 12:51 .
$ ls -l bar
-r-xrwxr--. 1 user root 0 Jul  7 12:51 bar
$ echo rabbits > bar
bash: bar: Permission denied
$ chmod 644 bar
$ echo rabbits > bar
$ cat bar
rabbits
$ ls -l bar
-rw-r--r--. 1 user root 8 Jul  7 12:54 bar

jh



More information about the CentOS mailing list