[opensuse] chmod question
Hello, Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod? -rwxr-Sr-t 1 root root 25016 Nov 6 11:38 temp.txt -rw-r--r-- 1 root root 9622 Mar 19 2005 generic Thank you, James -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
* James D. Parra
Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod?
-rwxr-Sr-t 1 root root 25016 Nov 6 11:38 temp.txt -rw-r--r-- 1 root root 9622 Mar 19 2005 generic
man chmod chmod +/- s <file-name> - -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn4472 (GNU/Linux) iD8DBQFHMOkhClSjbQz1U5oRAoh5AKCTlYQsR0fcdDfMKlVc0CL5tfjwdQCeKe3l iQHQDXwZNl6zKzNOgdd7v3E= =C2cw -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 06 November 2007 11:48, James D. Parra wrote:
Hello,
Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod?
-rwxr-Sr-t 1 root root 25016 Nov 6 11:38 temp.txt -rw-r--r-- 1 root root 9622 Mar 19 2005 generic
Thank you,
Patrick's generic and universal answer notwithstanding, the particular 'S' flag you showed is the "set group ID" bit. That means that if executed, the resulting process would execute with an effective group ID equal to that of the file's group ID (in this case, "root," or it's numeric counterpart). There's a corresponding "set user ID" bit which would put the 'S' signifier in the corresponding user position: % chmod g-s temp.txt % chmod u+s temp.txt % ls -l temp.txt -rwSr--r-t 1 root root 25016 Nov 6 11:38 temp.txt The capital 'S' is used when the corresponding execute bit is _not_ set. When the corresponding execute bit _is_ set, you get a lower-case 's'. In general, set-UID or set-GID have no real significance if the file to which they're applied is not executable. There is a "sticky" bit, but its meaning is quite different. I'll leave it as an exercise for you to discover that one (extra credit for the now-obsolescent original meaning).
James
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 06 November 2007 20:48:40 James D. Parra wrote:
Hello,
Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod?
No, it's not the sticky bit, the sticky bit is the t at the end. The S is the sgid bit, and you can set it with "chmod g+s <filename>" Incidentally, the fact that it's a capital S means that there isn't an x behind it. If you were to do "chmod g+x <filename>" it would become a small s Anders -- Madness takes its toll -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2007-11-06 at 11:48 -0800, James D. Parra wrote:
Hello,
Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod?
-rwxr-Sr-t 1 root root 25016 Nov 6 11:38 temp.txt -rw-r--r-- 1 root root 9622 Mar 19 2005 generic
Thank you,
James
The "S" is the setuid or setgid bit is set. Because it is shown in the second triplet, this denotes setgid. the uppercase convention denotes that the setgid is set and not the execute bit. Because it is shown in the last field of a triplet you cannot be shown both the normal execution bit status of either "-" or "x" depending on permissions. In the event that the setgid was set and the execute bit was also set then the "S" character would be lowercase. Also there could be a "t" character in this position to denote the sticky bit being set. The case convention also applies to the "t" character as well. Cheers. Thomas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
James D. Parra wrote:
Hello,
Out of curiosity, what is the S for in, -rwxr-Sr-t? Is that a sticky bit and id so, how is it set with chmod?
Set group ID bit. (setgid) Unfortunately, the assholes at the FSF refuse to put the full documentation for chmod in the man page, so you have to use the cumbersom and confusing (for non-emacs users) info system. I recommend using pinfo instead, as it's not quite as bad as info. pinfo chmod # for more information see also pinfo coreutils # and go to the section # titled File Permissions # then look at "Mode Structure" # and "Numeric Modes" # you can also look at Symbolic # modes, but this mechanism is # not always available on # various *nix systems. Here's the important part -- a file's "mode" is the Logical-OR of the following values: Mode Corresponding Permssion Bit User who owns file (u) 0400 Read (-r--------) 0200 Write (--w-------) 0100 Execute (---x------) users in file's group (g) (see /etc/group) 0040 Read (----r-----) 0020 Write (-----w----) 0010 Execute (------x---) Other users not in file's group (o) 0004 Read (-------r--) 0002 Write (--------w-) 0001 Execute (---------x) Special Permissions 4000 Set USER ID on execution (---S------) 2000 Set GROUP ID on execution (------S---) 1000 Sticky Bit (t) (---------t) For DIRECTORIES: === regular permissions === read permisission ability to list contents (/bin/ls ) write permission ability to create and remove files in directory. execute permission give the ability to change directory (cd) into the directory. === special permissions == Set User ID SETUID has no effect on directories. Set Group ID on some systems, no matter what creator specifies, all files in directory have the same group as the directory with SETGID set. sticky bit Only a file's OWNER can remove said file from the directory (rm or rmdir)
-rwxr-Sr-t 1 root root 25016 Nov 6 11:38 temp.txt -rw-r--r-- 1 root root 9622 Mar 19 2005 generic
Set Group ID (SETGID) for a text file is meaningless. Also, putting .txt on the end of a file is equally meaningless on anything other than M$ systems. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Aaron Kulkis
-
Anders Johansson
-
James D. Parra
-
Patrick Shanahan
-
Randall R Schulz
-
Thomas R. Jones