w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Trying to change the permissions of a symlink results in changing the permissions of its target

You are attempting to change the ownership of a symbolic link, however, the permissions of the link itself don't matter - what mappers are the permissions of the target that the link points to. If you do, for whatever reason, want to change the ownership of the actual symlink you can use chown -h:

$ ll
total 4.0K
lrwxrwxrwx 1 root root    3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 root root 4.0K Mar 25 08:18 foo/

$ chown -v quux:quux bar
changed ownership of `bar' from root:root to quux:quux

Note how it actually changed the target (foo):

$ ll
total 4.0K
lrwxrwxrwx 1 root root    3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/

$ chown -vh quux:quux bar
changed ownership of `bar' from root:root to quux:quux

$ ll
total 4.0K
lrwxrwxrwx 1 quux quux    3 Mar 25 08:18 bar -> foo/
drwxrwxr-x 2 quux quux 4.0K Mar 25 08:18 foo/




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.