Symlink and permissions

Suppose there is a symlink named "softlink" pointing to a target directory named "target-folder" as shown below,

==========================

:~> ll softlink lrwxrwxrwx 1 liju users 13 Mar 16 03:29 softlink -> target-folder
:~> ll -ld target-folder drwxr-xr-x 2 liju users 4096 Mar 16 03:29 target-folder

==========================

You can see the permission of "softlink" as 777 while the "target-folder" permission is 755, I tried to change the permission of "softlink" to 000 by executing the following command,

****************************
chmod 000 softlink
****************************

On checking the permission of softlink again, i could see the permission remains unchanged,

########################

:~> ll softlink lrwxrwxrwx 1 liju users 13 Mar 16 03:29 softlink -> target-folder

########################
and actually resulted in changing the permission of the target directory "target-folder",

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:~> ll -ld target-folder drwxr-xr-x 2 liju users 4096 Mar 16 03:29 target-folder
 :~> ll -ld target-folder d--------- 2 liju users 4096 Mar 16 03:29 target-folder

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So, my conclusions are the symbolic link has only 777 permission which is unchangeable and any change in the symlink will affect the target-file.

No comments:

Post a Comment