1753618 Members
5687 Online
108797 Solutions
New Discussion юеВ

File Permission of Links

 
SOLVED
Go to solution
TMcB
Super Advisor

File Permission of Links

Hi

I have created several links using ln -s.
I need to change the actual permissions of the links.
When I enter the chmod command, it is the actual file permissions of the file refereed to that is changed.
Is this possible?
Thanks for any help.
7 REPLIES 7
Andreas Voss
Honored Contributor
Solution

Re: File Permission of Links

Hi,

at my knowledge there's no chance to change the permission of the symlink itself.
Only solution:
Remove the symlink, set needed umask and recreate the symlink.

Regards
Alex Glennie
Honored Contributor

Re: File Permission of Links

You cannot change the permissions on a soft link because the system
ignores the permissions of a symbolic link.
The system only allows you to change the permissions on the file
that is linked to the symbolic link.
James R. Ferguson
Acclaimed Contributor

Re: File Permission of Links

Hi Terry:

No, once created, it is not possible to change the permissions of a symbolic link. The ownership and permissions of symbolic links do not matter, however. It's the ownership and permissions of the file pointed to by the symbolic link that govern access and action.

...JRF...
Ravi_8
Honored Contributor

Re: File Permission of Links

Hi,
there is no permissions to the link as such.
Hard links are created with the same ownerships and permissions as the file or directory to which they are linked.If ownership or permissions are changed on a link or file, the same changes appear on corresponding hard links. The ln command does not permit hard links to a directory

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.
never give up
Ray Browder
Advisor

Re: File Permission of Links

I am only pursuing this because I have started running a mandated security monitoring program that is warining me about the symbolic links.

I've read the various notes about the futility of trying to change the permissions of symbolic links. I accept this.

I've also read the notes about the umask affecting the permissions of the symbolic links. I have not been able to recreate this.

My questions are: I have seen symbolic links on my Tru64 V5.1 and V5.1A systems that are either 755 or 777. How were the 755 symbolic links created? My umask was 022 when I created several symbolic links, but the links came out 777.

I've read the notes about lchmod, this is not on Tru64. (HP-UX, FreeBSD, others?)

I have tried this on several other UNIX systems: Solaris, IRIX, AIX, and Linux(Alpha). Only on the IRIX system does the umask affect the permissions of the symbolic link. The other systems set the permissions to 777.

Thanks,
Ray
Jose Mosquera
Honored Contributor

Re: File Permission of Links

Hi,

Pls find attached the "lchmod" binary file from HP-UX 11. Works fine!

Rgds.
Ray Browder
Advisor

Re: File Permission of Links

Sorry, I entered my note in the wrong forum. I should have put it in the Tru64 forum.

Thanks for the lchmod file. I just don't have any systems that will run that file.

I'll re-enter my note in the Tru64 forum.

Thanks again,
Ray