1838721 Members
5412 Online
110129 Solutions
New Discussion

permission link file

 
SOLVED
Go to solution
Domingo Muñoz
Advisor

permission link file

I'm checking the security in own system and I have a question about link file startup. I'm seeing any link file has the permission 777 while you orginal file has other permission, for example, 444. I know the good permission is the original file but my question is:

Why do I see the permission different between the link file and original file?

Thanks,

8 REPLIES 8
Ceesjan van Hattum
Esteemed Contributor
Solution

Re: permission link file

Symbolic links are created with the ownership of the creator and the
permissions are of the creator's current umask. Once created, the
symbolic link ownership and permissions will not change, since the
mode and ownership of the symbolic link is ignored by the system.

Regards,
Ceesjan
James R. Ferguson
Acclaimed Contributor

Re: permission link file

Hi:

The permissions of a symbolic link are immaterial. The permissions of file pointed to by the link are the ones that matter.

In the case you describe, it appears that you created the link when your 'umask' was zero, and issued a 'chmod 444' for file to which it points.

Regards!

...JRF...
Domingo Muñoz
Advisor

Re: permission link file

How Could I make a link with same permission that the original file?
Domingo Muñoz
Advisor

Re: permission link file

I want to maintain the permits of the link in an automatic form
James R. Ferguson
Acclaimed Contributor

Re: permission link file

Hi (again):

You can make the permissions of your symbolic link the same as your file by first removing the symbolic link (which does *not* remove the file to which it points). Since your file has permissions of 444, set your 'umask' to 333 (since 777 - 333 = 444) and reestablish the symbolic link.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: permission link file

Just a note: while you can create the link with different permissions, you can't change it since it will try to change the to which it points. This also means that even if the file or directory changes permission, the link stays the same. A way to prove that the link permissions have no effect:

# umask 777
# ln -s /etc/issue mylink
# ll mylink
l--------- 1 blhassel users 10 Aug 14 13:58 xy -> /etc/group
# head -1 mylink
root::0:root

So yuo see that a link zero permissions still performs it's task and the 'real' permissions belong to the object pointed to by the link.


Bill Hassell, sysadmin
Jeff Schussele
Honored Contributor

Re: permission link file

Hey Bill,

That's some mighty powerful HP-UX magic you wield there changing mylink to xy & /etc/issue to /etc/group!
I can't wait 'til I grow up to be as powerful a SysAdmin magician!!!! =~)

Cheers,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Wodisch_1
Honored Contributor

Re: permission link file

Hi Domingo,

and for the not-so-mighty of us, we can simply use the option "-L" (upper case ELL) like here:

ls -lL you-link

and then "ls" will show the name of the link (and NO "->"), but the permissions of the real file!

HTH,
Wodisch