Linux Basic Knowledge Note 1--Permissions

Source: Internet
Author: User

Special usage of COMMON commands CP
Cp-i  # Overlay hint alias cp= "Cp-i" mv-i  # Overlay hint alias mv= "Mv-i"


Cp-r  # Copy directory cp-a  # reserved permissions


Cp-s a B  # link file, only with current directoryln-s a B  # A To use absolute path, B can not cp-d a B  # directly copy a linked file, so B Also Link to a linked file


Chattr, Lsattr
chattr +i   File # makes the files unable to move chattr +a the filename   # Append, can only be added, cannot be deleted and modified, to be deleted first Chattr-a filelsattr


Observing file types

Stat
FILE:ASCII data binary or is there a dynamic function library


Type
-T Show him the meaning of file. Alias. Builtin built-in
-A Lists the path
-P Displays the full file name of the external directive


File Special permissions: ID (list your own information)

Add another 1 digits before you change the permission 3 digits chmod nxxx FILE

4 SUID s Owner
2 SGID S Group
1 Sbit T Other
These 3 permissions are required by the X permission to support all, if a file does not have X permission, then directly to give
Special permissions will be overhead, is virtual, the system will prompt these permissions are capitalized SST


Suid:set UID

The S flag, which allows the executable to be owned by the host when it is run.
As long as you have X and suid, you can become USER at run time.


Pstree-u | grep root    |                        |      | -PASSWD (Root)

When a normal user runs passwd, it switches to the root identity.


SUID can only be used in binary files and cannot be used in shells


Sgid:set GID

When s this flag appears in group X, it is called set GID


The file is executed with the same rights as the user group.


After the directory has set the SGID permissions

    1. Users can enter this directory if they have r and X permissions for this directory;
    2. The user's active group (effective group) in this directory will become a group of that directory;
      Use: If the user has the permission of W in this directory (can create a new file), users are established
      New file, the group of the new file is the same as the group in this directory.


Sticky Bit

Sbit is currently only valid for the directory, when the user has W, x permission for this directory, but also has write permission;
When a user creates a file or directory under that directory, only himself and Root have the right to delete the file.




Linux Basic Knowledge Note 1--Permissions

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.