The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM



Thread: setuid and guid
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-11-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 674
Setting the sticky bit on a file instructs the kernel to not swap it out when running, it's seldom used these days.

Setting the sticky bit on a directory, however, instructs the filesystem to only allow a file to be deleted by it's owner, regardless off the write permissions the directory has set. This enables one to allow world write on a directory without allowing one user to interact with another user's files beyond the individual file's permissions. It's great for any directory where multiple users need to create files but you don't want one to delete another's.

A file that is setuid will, if executed, run with the permissions and id of the owner of the file (not necessarily the user logged in). This allows multiple users to share data or to escalate (or downgrade) rights.
It should be used with caution however as any bugs in the script or binary could be exploited to perform unintended tasks as the file owner. Anything forked off by the running executable will also inherit it's parent's rights so be careful of complex apps like vi, emacs etc that can start independant shells.

Setuid on a directory would normally cause any files created within that directory to be owned by the directory owner but this is disabled by default in solaris.

Setgid on a file does nothing on solaris as far as I know.

Setgid on a directory causes any files created to have their primary group set the the same group as the parent directory. It generally (depending on config and solaris revision) also sets the setgid bit on any subdirectories created.
Reply With Quote