Special Permissions in Linux

Source: Internet
Author: User

Linux has three special permissions in addition to normal permissions.

SUID:: As the user of the file to execute, and not the user to execute the file, more for the executable file, after setting SUID, in the permission bit, the last permission of the owning user becomes S, adding SUID permission can be represented by "+s".

Example: passwd

[email protected] ~]$ which passwd/usr/bin/passwd[[email protected] ~]$ ls-l/usr/bin/passwd-rwsr-xr-x. 1 root root 25980 Feb 2012/usr/bin/passwd[[email protected] ~]$

SGID: Primarily for folders, any new files created in the SGID folder are inherited by the owning group of the file, after setting SGID, in the permission bit, the last permission bit of the owning group becomes S, and the Add SGID permission can be represented by "+s".

For example:

[[email protected] ~]$ mkdir ultraera[[email protected] ~]$ ls-ltotal 4drwxrwxr-x 2 adam Adam 4096 Nov 21:09 ultraera[ [Email protected] ~]$ chmod g+s ultraera/[[email protected] ~]$ ls-ltotal 4drwxrwsr-x 2 adam Adam 4096 Nov 21:09 Ultra Era[[email protected] ~]$ su Password: [[email protected] adam]# mkdir-p ultraera/test[[email protected] adam]# ls-l ult Raera/total 4drwxr-sr-x 2 root adam 4096 Nov 21:09 Test[[email protected] adam]#

Sticky: For folders, users who have write permission to the directory can only delete the files they own, cannot delete the files owned by other users, set the sticky after the permission bit, and the last permission bit of other becomes T, adding sgid permission can be represented by "+t".

For example:

[[email protected] tmp]# mkdir ultraera[[email protected] tmp]# chmod  A=rwx,o+t ultraera/[[email protected] tmp]# ls -ld ultraera/drwxrwxrwt 2  root root 4096 nov 27 21:29 ultraera/[[email protected] tmp]#  useradd user1[[email protected] tmp]# useradd user2[[email protected]  tmp]# su user1[[email protected] tmp]$ touch ./ultraera/test[[email  Protected] tmp]$ ls -l ultraera/total 0-rw-rw-r-- 1 user1 user1 0  nov 27 21:31 test[[email protected] tmp]$ exitexit[[email protected]  TMP]# SU USER2[[EMAIL PROTECTED] TMP]$ RM -F ./ULTRAERA/TEST RM:  cannot remove  './ultraera/test ':  operation not permitted[[email protected]  tmp]$

Also use chmod to set special permissions, like normal permissions, special permissions can also be expressed in numbers:




chmod 4644 filename #设置文件suid权限chmod 2755 flodername #设置文件夹sgid权限chmod 1755 Flodername #设置文件夹sticky权限

This article is from the "South African Tribe" blog, please be sure to keep this source http://ultraera.blog.51cto.com/6640392/1583493

Special Permissions in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.