You already probably noticed that if you want to update the ownership of a symbolic link on any UNIX system, a simple chown won’t do the job.
Indeed, let’s suppose you have this:
8 lrwxr-xr-x 1 user1 group1 4 Jun 13 23:46 link -> test 8 -rw-r--r-- 1 user1 group1 6 Jun 13 23:54 test
If you’re doing a simple chown:
chown user2:group2 link
You can see that it changes the ownership on the target file and not on the symbolic link:
8 lrwxr-xr-x 1 user1 group1 4 Jun 13 23:46 link -> test 8 -rw-r--r-- 1 user2 group2 6 Jun 13 23:54 test
If you want to update the symbolic link, you need to use the -h or –no-dereference option to apply the changes on the symbolic link and not on the target:
chown -h user2:group2 link
Then, you can see that it’s now updated:
8 lrwxr-xr-x 1 user2 group2 4 Jun 13 23:46 link -> test 8 -rw-r--r-- 1 user2 group2 6 Jun 13 23:54 test