set user id and set group id bits

set user id and set group id bits

Post by Sang K » Sun, 31 Oct 1993 10:29:53



How can I find out whether a file has a set user id bit or set group id bit?
can "ls" tell me?

--
------                              
Sang Kim                        

 
 
 

set user id and set group id bits

Post by Todd D. Ta » Sun, 31 Oct 1993 15:28:22



>How can I find out whether a file has a set user id bit or set group id bit?
>can "ls" tell me?

Yes.  Use ls -l.

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
d       directory
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,
others.
In each block of the permissions section, the three most common values are:
r       read
w       write
x       execute
(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.

>------                              
>Sang Kim                        


--

U.N.C. Department of Computer Science Student Facilities Staff

 
 
 

1. What's the purpose of set-group ID bit for directories?

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?


2. dual-boot for a newbie

3. ow do I set a file to [set-group-ID] smmsp?

4. OCR Software for SVR4?

5. Does set GROUP ID have any meaning on a directory (was Re: Does set ...)

6. Diald + firewalling? Need help.

7. How to use set user id bit

8. Adaptec 3940 and 3985 RAID

9. Cannot Set Owner & User-ID bit to Root via script

10. Set User-ID bit on Shell Script?

11. Set-User-Id Bit

12. Q: set user ID bit and shared libraries

13. Set-User-Id Bit