How can I find out whether a file has a set user id bit or set group id bit?
can "ls" tell me?
You should get something like this: (without all the pretty lables, though...)
(If the group name is not displayed, try ls -lg)
Owner Group File
Permissions: Name: Name Size Last date File Name
drwx------ 2 taft other 4096 Oct 28 22:27 Mail
-rw-r-sr-x 1 taft sys 17822 Oct 3 22:19 Xamples
-rwsr-x--- 1 taft staff 8403 Oct 29 18:57 update.problem
| | | |
| | | +-- Other permissions
| | |
| | +----- Group permissions
| +-------- User permissions
+---------- Type of file
There are a number of values for type of file; the most common are:
l symbolic link
The remainder of the permissions are broken up into three group of three.
The first group is the user permissions; second, the group; and last,
In each block of the permissions section, the three most common values are:
(A dash in a slot indicates permissions denied.)
If there is an s in the user permissions section, this means the
set-uid bit is set; an s in the group permissions section means the
set-gid bit is set. The s goes in the slot normally occupied by the
x, as set-uid or set-gid files are almost always executable. So,
Xamples is a set-gid file, update.problem is a set-uid problem.
For details on how to set these various permissions, see the man page
for chmod. To interpret the less common file types and file
permissions see the man page for ls.
Well, I think I may have answered my question already, but
I'll go ahead and post it just to verify myself.
I've been searching various man pages to find out what's the
point of the set-group ID bit on directories.
For instance, consider this directory:
drwxr-sr-x 3 root 512 Nov 8 19:29 etc/
I've been trying to figure out what happens with the 's' bit
set and what doesn't happen. I think I finally found out from
an IBM man page (chmod(2)):
S_ISGID Enables the setgid attribute for an executable file. A
process executing this program acquires the access rights of the
group of the file. Also, enables the group-inheritance attribute
for a directory. Files created in this directory have a group
equal to the group of the directory.
From this, I gather that directories with this bit set change
the group of any files created in them to be of the same group
as the directory itself, rather than of the user making the files.
Why was this information so hard to find? That is, why wasn't it in
the obvious place (chmod(1) or chmod(2)) in the man pages for DEC, Sun,
or HP systems?
11. Set-User-Id Bit
13. Set-User-Id Bit