User rights, file permissions, and directory permissions in "Linux 06" Linux

Source: Internet
Author: User
Tags file permissions

  1, User and user group concept:

1. File owner

2. User groups

3. User

After you log on to Linux as root, execute ls-al and see information about the properties of the file

-rw-r--r--, The 1th character indicates that the file is "directory, file or link file, etc.", [d] represents the directory, [-] represents the file, [l] is the connection file. The next character 3 groups represents the permissions of the file owner, the same user group, and other non-user groups.

  2. Change file attributes and permissions

Change the file belongs to user group: CHGRP

Chgrp Commonuser Install.log

Change file owner: Chown

Chown [-r] Account name file or directory (R is the case for changing all files in the directory)

Chown Commomuser Install.log

Change the owner and user group of Install.log to root

Chown Root:root Install.log

Chown can also simply modify the user group Chown. Commomuser Install.log

Change permissions: chmod

Method One: Number types change file permissions

Permissions can be represented by numerical values: R:4, W:2, x:1
chmod [-r] XYZ file or directory

chmod 777. BASHRC

Method Two:

Symbol types Change file permissions: User, group, others three bodies can be represented by u, G, O, and a represents all as full identity

chmod U=rwx,go=rx. BASHRC
chmod u=rwx,g=rx,o=r filename

If you do not know the properties of the original file, you only want to increase the. BASHRC per-person writable permission for this file:

chmod a+w. BASHRC

Remove Execution Properties:
chmod a-x. BASHRC

  3, permissions are divided into directory permissions and file permissions

For a file, the permissions can be:

R: Can read the actual contents of the file

W: You can edit, or modify, the contents of the file, but you cannot delete the file

X: The file has permissions that can be executed by the system

In terms of the directory, the permissions can be:

R: can read contents of directory

W: You can modify the contents of the directory, including deleting files in that directory

X: You can enter the directory to make it your working directory

To open a directory for anyone to browse, you should at least give R and X permissions (do not give x directory information can not be fully displayed), but W permissions can not be given!

    

  

User rights, file permissions, and directory permissions in "Linux 06" 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.