Operating System - HP-UX
1832592 Members
2909 Online
110043 Solutions
New Discussion

Set group, user bit and symbolic link

 
SOLVED
Go to solution
yc_2
Regular Advisor

Set group, user bit and symbolic link

Hi,

1) How to get the following:

-rwsr-sr-- file

Tried chmod u+s file but got the following:
-rwSr--r-- file

2) How to create soft link with the same permission of the above file ?


Thanks in advance,
YC
3 REPLIES 3
Steven Gillard_2
Honored Contributor
Solution

Re: Set group, user bit and symbolic link

In answer to your questions:

1) Run:

$ chmod u+x,g+xs

The capital S indicates that the setuid bit is set but the execute bit is not. See the ls(1) man page for a description of this.

2) The permissions of a symbolic link are not important - those on the underlying file will always be used.

Regards,
Steve
Darrell Allen
Honored Contributor

Re: Set group, user bit and symbolic link

Hi,

Two ways:

chmod u=rwxs,g=rxs,o=r file

-or-

chmod 6754 file

Although the second method is
"Obsolescent", I still find it easier.

As Steve said, perms on a symlink don't really matter however if you modify your umask first then the softlink's permissions will be different.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Darrell Allen
Honored Contributor

Re: Set group, user bit and symbolic link

By the way, you can't change the permissions on an existing symlink. You would have to delete it, change your umask, then recreate it. But again, the permissions don't really matter on a symlink.

Also, from the man page for umask: Note that the file creation mode mask does not affect the set-user-id, set-group-id, or "sticky" bits.

Since umask doesn't affect the above bits and since you can't modify perms on an existing symlink, you can't set a symlink to the perms you want.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)