Subj : Re: chmod 2711 not excutable under linux To : comp.unix.solaris,comp.os.linux From : ibuprofin Date : Tue Dec 21 2004 03:17 pm In article <41c7acd8$1@news.starhub.net.sg>, 19owls wrote: >> I have a script that is chmod 2711 (-rwx--s--x) so that it's excutable >> for group and user but NOT readable by them. >what does the '2' in front of the 711 represent? man 2 chmod Notice the permission is shown as '-rwx--s--x' and not '-rwx--x--x' The fourth digit when used in referring to file permissions refers to 'set group ID' (also 'set user ID' and 'set sticky bit'). A 'SUID' binary runs as the user who owns the binary, rather than the person who typed the command. Likewise, a 'SGID' binary runs as the group owner, rather than the groups of the user. You can also set the 'SGID' bit on directories, and that means that files created in that directory will be owned by the group owner of the directory, rather than the primary group of the person creating the file. The 'sticky bit' had historic meaning that the file need not be saved when being swapped out of memory (instead, you reloaded from normal storage). Today, this bit is normally used on directories, where it means that only the owner of the file can delete it. You normally see this on a tmp directory (where everyone may be able to write files). The 'ls -l' command shows the permissions thusly: chmod ls -l 4700 -rws------ 4600 -rwS------ 2750 -rwxr-s--- 2740 -rwxr-S--- 1777 drwxrwsrwt <-- typical permission on /tmp/ 1776 drwxrwxrwT <-- rarely used permission on a directory Old guy .