Unix: SETUID & SETGID in Solaris

This item was filled under [ General, Solaris ]

Set-User-Identification (setuid) permission enables a user to access files and directories that are normally available only to the owner. Set-Group-Identification (setgid) permission is similar to setuid , except that with setgid the process’s effective GID is changed to the group owner of the file, and a user is granted access based on permissions granted to that group.

A user can set the UID or GID permission for any file he/she owns. The setuid and setgid permissions can be identified by using “ls -l” command. The first “s” in the permission field of the following example indicates the use of the setuid, and the second “s” indicates the use of setgid.

Example:

bash-3.2# ls -l file1

-r-sr-s–x 1 root root 20 Oct 9 16:18 file1

The following example illustrates how to set the UID on an executable file named file1:

bash-3.2# chmod 4711 file1

you can verify the change by entering this:

bash-3.2# ls -l file1


The system responds with this:

-rws–x–x 1 root root 20 Oct 9 16:18 file1

The following example illustrates how to set the GID on an executable file named file1:

bash-3.2# chmod 2751 file1

you can verify the change by entering this:

bash-3.2# ls -l file1

the system responds with this:

-rwxr-s–x 1 root root 20 Oct 9 16:18 file1

  • Share/Bookmark
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment

  • Google Translator

      Translate to: