"Linux Learning" Linux file permissions (i)

Source: Internet
Author: User
Tags readable

Linux operating system is a very good operating system, but also a multi-user, multi-tasking operating system. Then this means that there will be a lot of people using the same operating system at the same time. At this point, for a user, to protect their privacy is a very important issue.

★ User and user groups

"User and user group" can solve this problem very well, users can set their own file permissions according to their own wishes.

File owner

The file owner, by definition, is the user who owns the file. If there are some private files under my user that you do not want others to see, I can set permissions on the file: only their own users (the file owner) can modify or view the files, other users do not have the right to view or modify.

User groups

User groups are a useful feature. In the software development process, I have some files to share with my teammates, but I do not want to allow people other than my team to access these files, this time the user group will play its role. You can put the team's teammates corresponding to a user group, and then you can set the permissions of the file: the same user group can access the file, different groups of users cannot access the file.

Other users

Other users refer to users outside the user group, and my users can also set some permissions to restrict access to files by other users.

★ User's relationship with user group

If there are three users Tom, Marry, Lass, they belong to Tom. Under this user group, for some common files, users in the same user group can access it. This is like four people in the same bedroom, can be shared with a toilet, the same as the same faucet. However, for these three users more private files can be set to restrict access to other users through the file permissions. Just like the people in the same dorm room, although they can have a toilet, but can't look at your drawer at random.

★linux file Properties


The first column represents the type and permissions of this file

The first character indicates that the file is a "directory, file, or linked file"

If the first character is [d], the directory

If the first character is [-], then the file

If the first character is [l], it is a linked file

In the following characters, a group of 3, the first group is "permissions of the file owner", the second group is "permissions for the user group", and the third group is "other non-user group permissions", from the Internet search pictures


The second column indicates how many file names are linked to this node (I-node) The third column indicates that the file or directory's "file owner" column fourth represents the user group to which the file or directory belongs

Under Linux, a user may be affiliated with one or more user groups, as shown, users in the user group have readable, writable, and executable permissions on the file.

It suddenly comes to the question: a user can be attached to several user groups at the same time, but for a file, its restrictions on user groups are only readable, writable, and executable. So what do you do when a user wants to share a file in one of the user groups in a multi-user group? ?

The size of this file, the default unit is B Sixth column is the creation date of this file or is the most recent modification date seventh column file name ★ Files permissions importance data sharing

The users under the same user group as mentioned earlier can share some files

Improper permissions settings when

If the permissions are not properly set, some privacy breaches may occur. Or to set some very important system file permissions to others can access, there will be some unexpected trouble.

So before modifying a Linux file or directory, be sure to figure out what data is mutable and what is immutable.








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.