Categories of basic permissions
Access mode (permissions):
-read/write: Allow viewing of content-read R
-Write: Allow content to be modified-write W
-Executable: Allow to run and switch-execute x
For text files:
R:cat Head Tail Less
W:vim
X: Run
Permissions are appropriate for the object (attribution):
-Owner: The user who owns this file/directory-user u
-Owning group: The group that owns this file/directory-group g
-Other users:-other o for users other than the owner, the owning group
Start with "-": File
Start with "L": Shortcut
Starting with "D": Directory
Use the chmod command:
chmod Attribution Relation "+,-, =" Permission category document
Format: Chmod-r recursion grant permission
Example: Mkdir/nn
chmod u-x/nn (minus x permissions for the owner of the directory nn)
chmod g+w/nn (add W permission to the owning group of the directory nn)
chmod o=rwx/nn (assigning rwx permissions to other users)
How to determine what permissions a user has:
1. Determine the identity that the user belongs to.
2. Look at the permissions of the corresponding permission bit division.
Owner > Owning group > Other people matching and stopping
The r permission of the directory: to be able to browse this directory content ls.
W Permissions for the directory: ability to perform rm/mv/mkdir/touch/, and so on, to change directory contents.
Directory x permissions: Ability to switch to this directory on CD.
Set Document Attribution:
Use the Chown command for modifying user groups (Uid,gid)
Useradd Lisi
Groupadd TARENA1
Chown tarena1 (UID): root (GID)/lisi (default UID is root)
Special permissions (additional permissions):
Set UID (binary only)
-Attach to the X-position of the owning master.
-The owner's permission identifier will change to S.
-For executables, Set UID allows the user to have the file owner
Identity and partial permissions. (Pass-through owner identity)
Set GID
-Attaches to the X-bit of the owning group.
-the permission identifier of the genus Group becomes S.
-for executables, set GID allows the user to have a group of files
's identity and full permissions. (Pass the owning group identity)
Applies to the directory, set GID can be the directory under the new document is automatically set to the parent directory of the same genus Group.
Example: Mkdir/hrhjo
chmod G+s/hrhjo
Mkdir/hrhjo/haha
Sticky Bit
-Attach to other people's X-positions.
-The other person's permission identifier will change to T.
-A directory for open W permissions, which prevents ordinary users from abusing W Write permissions (Prohibit manipulating others ' documents).
Example: mkdir/phy
chmod o=rwx/phy
chmod o+t/phy
Basic permissions and special permissions for Linux