0% found this document useful (0 votes)
76 views

LAMP Chapter3

This document discusses special permissions in Linux/Unix systems: 1) Special permissions include suid, sgid, and sticky bit permissions in addition to typical user/group/other permissions. 2) Suid permissions cause an executable file to run with the permissions of the file owner rather than the user running it. Sgid permissions assign the group of new files in a directory to be the group owner of that directory. 3) The sticky bit permission restricts file deletion in a directory to the file owner and root only, regardless of other write permissions. These special permissions are set using chmod with a leading digit before the typical three-digit permissions.

Uploaded by

Niyaman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

LAMP Chapter3

This document discusses special permissions in Linux/Unix systems: 1) Special permissions include suid, sgid, and sticky bit permissions in addition to typical user/group/other permissions. 2) Suid permissions cause an executable file to run with the permissions of the file owner rather than the user running it. Sgid permissions assign the group of new files in a directory to be the group owner of that directory. 3) The sticky bit permission restricts file deletion in a directory to the file owner and root only, regardless of other write permissions. These special permissions are set using chmod with a leading digit before the typical three-digit permissions.

Uploaded by

Niyaman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 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