linux-Basics-day Fourth

Source: Internet
Author: User

I. Rights Management

The permissions for a file are defined primarily for three types of objects:

Owner: Master, u

Group: Genus, G

Other: Others, O


Each file has three permissions defined for each type of visitor:

R:readable

W:writable

X:excutable


File:

R: You can use the File View class tool to get its contents;

W: can modify its contents;

X: This file can be brought to the kernel to boot into a process;


Directory:

R: You can use LS to view the list of files in this directory;

W: You can create files in this directory, or delete files in this directory;

X: You can use Ls-l to view the list of files in this directory, CD access to this directory;


Combination of permissions

---000 0

--x 001 1

-w-010 2

-WX 011 3

r--100 4

R-x 101 5

RW-110 6

RWX 111 7


For example:

640:rw-r-----

755:rwxr-xr-x


Modify file Permissions: chmod

chmod [OPTION] ... Octal-mode FILE ...

-R: Recursive Modify permissions


chmod [OPTION] ... Mode[,mode] ... FILE ...

MODE:

To modify all permissions for a class of users:

u=

g=

o=

ug=

A=

u=,g=


Modify one or some bit permissions for a class of users

u+

U-


The owner and owner of the modified file: only root is available;

Modify the owner of the file: Chown

chown [OPTION] ... [OWNER] [: [GROUP]] FILE ...


Usage:

OWNER

Owner:group

: GROUP


Note: The colon in the command is available. Replace;


-R: Recursive


Masking code when a file or directory is created: Umask

File:666-umask

Note: If there is an X permission in the result of a user with a class that has the permissions reduced, its permissions +1

Dir:777-umask

Umask: View

Umask #: Setting


Hide Permissions Lsattr/chattr


The host is exposed directly to the Internet or in other dangerous environments, has many shell accounts or provides network services such as HTTP and FTP, and should generally be installed after the installation


Tighten use the following command:

Chattr-r +i/bin/boot/etc/lib/sbin

Chattr-r +i/usr/bin/usr/include/usr/lib/usr/sbin

Chattr +a/var/log/messages/var/log/secure (...)


Lsattr is generally used to view the above file





linux-Basics-day Fourth

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.