Linux folder and File Permissions

Source: Internet
Author: User

 

Drwxr-x --- 46 Jibo 4096 _ SRC

They correspond:
File Attribute connection count file owner group file size file modification time file name

Here, R is readable, W writable, and X executable. The file attributes are divided into four sections, ---- --- 10 positions.
For example:
D rwx R-x r-x
The first character specifies the file type. In general, a directory is also a file. If the first character is a horizontal line, it indicates a non-directory file. If it is D, it indicates a directory.
The second part is the attributes of the file owner,
The third section is the attributes of the group to which the file belongs,
The fourth section is the attributes of other users.

You can use the CHMOD command provided by Linux to reset different access permissions. You can also use the CHOWN command to change the owner of a file or directory. Use the chgrp command to change the user group of a file or directory.

CHOWN command

Function: Modify the owner and group of a file or directory. This command is also very common. For example, if the root user copies a file to Xu, the root user should set the owner of the file to Xu to allow Xu to access the file. Otherwise, user Xu cannot access this file.

Syntax: chown [Option] user or group file

Note: chown will change the owner of a specified file to a specified user or group. Users can be user names or user IDs. A group can be a group name or group ID. Files are separated by spaces to change the permission list. Wildcards are supported.

Parameters:

-R recursively changes the owner of all subdirectories and files under a specified directory.

-V: displays the work done by the CHOWN command.

Example 1: Change the owner of the Shiyan. c file to Wang.

$ Chown Wang Shiyan. c

Example 2: Change the owner of the directory/his and all files and subdirectories to Wang and the group to users.

$ Chown-r Wang. Users/his

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.