Linux file attributes and permissions management

Source: Internet
Author: User
Tags file permissions

One, file properties

Use the command "Ls-al" to list all the files (directories) and their attributes in the current directory, for example:

D Rwxr-xr-x 3 Root Root 3242 Dec 12 09:33 Abc
1 2 3 4 5 6 7 8

1: File type, D represents the directory,-represents a normal file, B represents a block device file, C represents a character device, p represents a pipe file, and s represents a nested machine file.

2: Permission, R for Read, W for write, X for file to execute, for directory to enter this directory,-no permissions. 9 characters are divided into three groups, respectively, the owner of the file, group, and other people's permissions.

3: The number of files in the directory or the number of hard links in the file.

4: File owner.

5: Group of files.

6: If the file represents its size, the directory represents the size of the filename it contains.

7: Date modified.

8: File name or directory name.

Ii.. File permissions

There are two ways to express file permissions, one is to use R, W, X to represent the letter permission, and one is a digital permission to be represented by a number. The numeric permission converts the letter of the letter permission to a decimal number, and three sums it for a group.

R W X-

4 2 1 0

such as: Rwxr-xr-x the corresponding permission is 755.

Third, Rights management

Modify file permissions: chmod [-R] < permissions > < files >

    • Change the file permissions to rw-r--r--:chmod 644 File
    • Change all file permissions in Dir directory and its subdirectories to 755:chmod-r 755 dir
    • To the owner of file files executable permissions (U means master, G for Group, O for others):chmod u+x file
    • Deprive the host to execute permission, give group members Read permission, deprive others write permission:chomod u-x,g+r,o-w file

Modify file Owner: Chown [-R] < account > < file >

    • Modify file's owner to LxW:chown LxW file
    • Recursive modification of all files under Dir directory the owner is LxW:chown-r LxW dir

Modify file groups: Chgrp [-r] < groups > < files >

    • Modify file group to class:chgrp class file
    • Recursively modify all the file groups in the Dir directory as class:Chgrp-r class dir

Linux file properties and Rights management

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.