-   Linux - Newbie (

Linux_interest 08-28-2004 01:58 AM

I was looking at program /usr/bin/chsh, and found that the word "S" instead of "X" on the permission :


Wondering, what was this "S"?

Also, i was practising a few command: I got a root user, and two general users which i created, ie. player1 and player2, both in the same group.

Now, i want to make player1 as the root person too, that is a superuser, so i know the user id of the super user is 0. I was wanting to know the command for changing this? After this, i want to change again the uid and gid of player1 to that of player2. Please help me in my these three quries, as i am really new and fresh to Linux.

Awaiting reply from some one.


or1onas 08-28-2004 02:03 AM

s instead of x in the owner permissions means that the 'sticky bit' (suid) is enabled, so this file will be executed with root permissions by all users...

btmiller 08-28-2004 02:31 AM

Actually, the setuid bit is not the same as the sticky bit. The sticky bit is a t instead of an x in the other permissions (e.g. for /tmp). The setuid bit is as or1onas says, while the sticky bit set on a directory implies users may only rm files in that directory if they own them (a handy thing for /tmp). On older Unices, the sticky bit caused the system to keep the program's text segment in memory, but on modern systems with modern memory handling this is no longer necessary.

Sorry -- I had to pick a nit...

or1onas 08-28-2004 02:35 AM bad ;)

amfoster 08-28-2004 09:22 AM

Just to go a bit further...

chmod 4777 filename will change the mode to rwsrwxrwx You can run a simple find / -perm +4000 to get a list of all the suid files. You will notice a lot of network applications since root does all network related tasks.

chmod 2777 directoryname will set the sgid. If I have a dir named share and it is owned by root and owned by a group named buddies, then when the sgid bit is set on that directory, any file created or placed in that directory will be owned by the buddies group regardless of who put the file in there.

btmiller described the stickybit perfectly.
