Tuesday, August 19, 2014

Three Special Permission in Linux - SUID, SGID & Sticky Bit.

7:45 AM

Three special permission in linux are SUID, SGID and Sticky Bit which is use to control the linux user in advance.



What is SUID?

The common explanation given for SUID is, it is an advance file permission SUID allows an user to execute a script as if the owner of the script is executing it.

Example for SUID

root@linuxstorages:~#ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 22984 Jan  2006 /usr/bin/passwd

SUID bit is set on an executable. It runs with the permission of its owner.

Command :

root@linuxstorages:~#chmod u+s  < file name >

                                  or

root@linuxstorages:~#chmod 4755  < file name >


What is SGID?

If the set gid bit on directory entry is set, file in that directory will have the group ownership as the directory, instead of than the group of the user that created the file.

Command :

root@linuxstorages:~#chmod g+s  < file name >

                                 or

root@linuxstorages:~#chmod 2755  <file name >


What is Sticky Bit?

Before set the sticky bit permission for folder, the irrespective of the users has rights to delete the folder. If the sticky bit permission set for the folder, respective of the user has rights to delete the folder.

Example for Sticky Bit

root@linuxstorages:~#ls -ld /tmp
drwxrwxrwt 32 root root 36864 Mar 27 12:38 /tmp

Command :

root@linuxstorages:~#chmod o+t  < Dir Name >

                                   or

root@linuxstorages:~#chmod 1777 < Dir Name >

Written by

1 comments :

 

© 2014 Linux Storages | Updated . All rights resevered. Designed by Templateism