Wednesday, September 7, 2016

Working with Special Permissions

Working with Special Permissions
Most of the tasks you will complete with permissions will be with the read, write, and execute permissions. However, there are several other special permissions you can assign to files and directories in your file system. These are shown in Table 11-3.


These special permissions are referenced as an extra digit added to the beginning
of the file or directory’s mode. As with regular permissions, each of these special permissions has a numerical value assigned to it, as shown here:

SUID: 4
SGID: 2
Sticky Bit: 1

You can assign these special permissions to files or directories using chmod. Just add an extra number to the beginning of the mode that references the special permissions you want to associate with the file or directory.

For example, suppose you wanted to apply the SUID and SGID permissions to a file named runme that should be readable and executable by Owner and Group. You would enter chmod 6554 runme at the shell prompt. This specifies that the file has SUID (4) and SGID (2) permissions assigned (for a total of 6 in the first digit).

It also specifies that Owner and Group have read (4) and execute permissions (1) assigned (for a total of 5 in the second and third digits). It also specifies that Others be allowed to read (4) the file, but not be able to modify or run it (for a total of 4 in the last digit).



No comments:

Post a Comment