Beginning the Linux Command Line by Sander van Vugt

Beginning the Linux Command Line by Sander van Vugt

Author:Sander van Vugt
Language: eng
Format: epub, pdf
ISBN: 9781430268307
Publisher: Apress


Notice that this means that sticky bit cannot be used to prevent users to remove files from their home directory. As the user is owner of the home directory, the user will always have permissions to remove files from this directory.

When using ls -l, you can see sticky bit as a t at the position where you normally see the execute permission for others:

nuuk:/groups # ls -ld account/

drwxr-sr-t 2 root account 4096 Dec 14 15:17 account/

Applying Advanced Permissions

To apply SUID, SGID, and sticky bit, you can use chmod as well. SUID has numerical value 4, SGID has numerical value 2, and sticky bit has numerical value 1. If you want to apply these permissions, you need to add a four-digit argument to chmod, of which the first digit refers to the special permissions. The following line, for example, would add the SGID permission to a directory, and set rwx for the user and rx for the group and others:

chmod 2755 /somedir

It is rather impractical if you have to look up the current permissions that are set before working with chmod in absolute mode (you would risk overwriting permissions if you didn’t). Therefore, I recommend working in relative mode if you need to apply any of the special permissions. For SUID, use chmod u+s; for SGID, use chmod g+s; and for sticky bit, use chmod +t followed by the name of the file or the directory that you want to set the permissions on.

Table 7-3 presents all you need to know about these special permissions.

Table 7-3. Working with SUID, SGID, and Sticky Bit



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.