Operating System - HP-UX
1820475 Members
3054 Online
109624 Solutions
New Discussion юеВ

sticky bit, setuid, setgid

 
Omar Alvi_1
Super Advisor

sticky bit, setuid, setgid

Hi,

Can someone point me to a good document with comprehensive coverage of the different (special) permissions. The setuid, setgid, stickey bit and all.

As I understand it, we have four types

-rwx-r-xr-s - setuid
-rwx-r-sr-x - setgid
-rws-r-xr-x - ?
-rwx-r-xr-t - sticky bit.

... these permissions are supposed to add upto seven octal. 7xxx.

and in addition, the meaning of each of these differs when its implemented for a directory or a file.

Thanks,

-Alvi
3 REPLIES 3
Elmar P. Kolkman
Honored Contributor

Re: sticky bit, setuid, setgid

-rwsr-xr-x - setuid : the program will be run with effective user id being set to the owner of the file

-rwxr-sr-x - setgid : the program will be run with effictive group id being set to the group of the file

-rwxr-xr-t - not possible

drwsr-xr-x - setuid on directory. I don't know the effect

drwxr-sr-x - setgid on directory. All files and directories placed in this directory will be of the same group as the directory itself.

drwxrwxrwt - sticky bit on directory. This means that only the owner of a file or root can remove its files.
Every problem has at least one solution. Only some solutions are harder to find.
Stefan Farrelly
Honored Contributor

Re: sticky bit, setuid, setgid

Its all in the manpage on chmod. Take a look.

setuid is -rws-r-x-r-x (or -rwS-r-x-r-x)
setgid is -rwx-r-s-r-x (or -rwx-r-S-r-x)
Sticky bit is correct, t at the end.

If x permission is on (it uses the same field as setg/uid) then s is shown as an uppercase S, if not then lowercase.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Umapathy S
Honored Contributor

Re: sticky bit, setuid, setgid

Omar,

These are all explained in chmod and ls man pages. Take a look at them.

S will be there if the execute permission is not set.

sticky bit on a dir allows only the owner to delete the files.
sticky bit on a file (binary) saves the Text image meaning the binary is loaded only once in memory.
HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!