File permissions: Normal (R, W, X) and special (S, t)

Source: Internet
Author: User


In Linux, the issue of permissions is often involved. The permissions of the file are 3 groups, Owner,group,other, each group has rwx three kinds of settings. R (4): Readable, W (2): writable; x (1): Executable.
When we execute the shell command ls-l, we show all the information of the file, the first group is the advanced properties in the file properties, permissions. This group has a total of 10 cells, each of which is a bit.  The first one is a special bit:  d represents the directory;
L represents a connection file;-represents a file; B is an interface device that is available for storage in a device file, C is a serial port device (such as a keyboard, mouse) in an appliance file, and s means that the file is a socket information, typically used for netwo before the process   RK Socket Access communication used by the file; P represents the data transfer document (Fifo,pipe), and its main purpose is to solve the error caused by multiple programs accessing a file simultaneously.   The next 9 grids are assigned according to the previous 3 groups, and the read, write, and execute permissions are set for each group. Note here: If you want to open a directory, make sure that X can execute permissions have been assigned to the user or group, otherwise it is not read and write, that is, you give the r,w is not intended
of righteousness.


Modification of file permissions:chmod: Change the properties of files, suid and other characteristicsUsage: chmod [-R] 777 Dir/filename (note: 7=r+w+x;6=r+w;5=r+x;3=w+x) chmod [-R] a+rwx dir/filename chmod [-R] U-r di R/filename chmod [-R] U=rwx,go=rx Dir/filename(Note: A: All users and groups; u: owner; g: Group; O: others.) +: add permission;-delete permission; = Grant permission)CHGRP: Change the group usage of the file: Chgrp [-R] group Dir/filename chown: Change file Ownerusage: chown [-r] User dir/filename;By the way, you can change the groupChown [-R] User:group dir/filename
In addition to these general permissions, we can also set advanced permissions, or special permissions:
Suid/sgid/sticky Bit (File special permissions):
SUID (Set UID): Will make the permission of S, the permission number is 4. This permission can only be used for executables, not for directories, nor for Shell script. Enables a general consumer to temporarily have permission to the owner of the file while executing the file.
SGID (Set GID): Make the S permission, the permission number is 2. This permission can be used for directories and files. When acting on a directory, the group of all files and directories created under that directory is the group of that directory, and when the file is applied, the active group (effective group) will become the group owner of the program, regardless of who the user is executing it (group ID )。
Sticky Bit: Make the T permission, the permission number is 1. In the directory where this permission is used, if the user has w,x permissions, then the files and directories that he creates can only be deleted by the owner and root of the file.




Note: When a character represents a permission, S and T are in the position of X, meaning that they are meaningful in executable files and directories. If the file or directory itself u, G, or O is not available
Execute permissions, then the permission group it is in appears to be s or T, which means null.
Source:

From for notes (Wiz)

File permissions: Normal (R, W, X) and special (S, T) (RPM)

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.