You are on page 1of 8

FOSS / LAMP

Session 3

Revathi J
Bharathidasan University Technology Park (BUTP)
Bharathidasan University
Special permissions
• A fourth permission set (in addition to
user/group/other)

• Applicable in four cases:


Set user ID or suid for an executable
Set group ID or sgid for an executable
Set group ID or sgid for a directory
Sticky bit for a directory

• Use the chmod command, preceeding the


usual three digits with a digit representing the
special permission :
4 for suid, 2 for sgid, 1 for the sticky bit.
Special Permissions for Executables
• The Set UID Permission

• Suid : Command run with permissions of


the owner of the command, not exexcutor
of the command

• In long listing, the suid permission is


displayed as a lower case “s” where the “x”
would otherwise be located for the user
permission.
Example - SUID
• Create a new file
$ touch su1

• To view the permission


$ ls -l su1

• To set SUID permission


$ chmod 4777 su1

• To view the modified permission


$ ls -l su1
Set gid command
• sgid : files created in directories with the sgid bit
set have group affiliations of the group of the
directory.

• This is commonly used on group directories:

$ chmod 2770
$ ls –l groupdir
Example
• Create group
groupadd colleges
• Create users of the group
useradd -G colleges jmc
useradd -G colleges hcc
• Create group directory
mkdir /csdata
• Assign group directory to a group
chgrp colleges /csdata
• Create SGUID for group directory
chmod 2770 /csdata
Special Permissions for Directories
• Sticky Bit

Files and directories with the sticky bit set can only
be removed by the owner and root, regardless of the
write permissions of the directory.

• For group directory /csdata, to set a Sticky bit


chmod 3770 /csdata
Thank You

You might also like