Linux file permissions

Source: Internet
Author: User

1. File owner, owning user group, other users
1) file owner: User who created the file
2) Owning user group: which user group the file belongs to
3) Other users: not the file owner, the user who does not belong to the user group to which the file belongs, called another user

2.Linux file Permissions
We switch to the root user, create a new myfile folder,
Then use the ls-al|grep myfile command to view the file properties as shown in:

File type Owner rights user group permissions Other user rights connection number owner user group file Capacity (B) Modified Date file name
D rwx r-x r-x 2 root root 4096 6/29 9:00am myfile

Permissions in the three-bit represent R (read), W (write), X (execute) The file contents of the permission, if-, indicates that there is no corresponding permission.

For a folder, the content is the list of file names in the folder.
R: Readable List of filenames
W: can create new, delete, rename file name
X: Permission to enter a folder
To execute the folder's W permissions, you must first have permission to enter the folder, so you must have X permission to use W permissions.

For a file, the content is the file content itself
R: can read file contents
W: Can modify the contents of the file
X: Executable file

Visible, the permissions of the file itself is only related to the contents of the file, the file is added, deleted, renamed, you need the file in the directory where the W permission.

3. Modify File Permissions
1) chmod: Modify file permissions
Use the values corresponding to the permissions to modify the permissions,
r:4,w:2,x:1
The value of rwx is 4+2+1=7
The value of R-x is 4+0+1=5
The value of rw-is 4+2+0=6

chmod rwx Value file name
Can modify the file to the appropriate permissions, such as we modify myfile other user rights to rwx, modify the command is: chmod 757 myfile

2) Chgrp: Modify the user group to which the file belongs
Chgrp Ubuntu myfile
You can change the MyFile user group from root to Ubuntu

3) Chown: Modify file Owner
Chown Ubuntu myfile Modify file Owner
or chown Ubuntu:ubuntu myfile Modify both the file owner and the user group that the file belongs to

4. Special File permissions

Linux file permissions

Related Article

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.