[Linux learning] Linux File permissions (1)

Source: Internet
Author: User

Linux is an excellent operating system and a multi-user, multi-task operating system. This means that many people will use the same operating system at the same time. At this time, it is critical for a user to protect their privacy.

★Users and user groups

"Users and user groups" can solve this problem well. Users can set their own file permissions as needed.

● File owner

The file owner is the user who owns the file. If my users have some private files that they do not want to see, I can set the file permissions: Only my users (File owners) can modify or view these files, other users do not have the right to view or modify.

● User Group

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 anyone except my team to access these files, at this time, the user group will play its role. Users corresponding to teammates in the team can be placed under a user group, and then the file permissions can be set: files can be accessed in the same user group, and files cannot be accessed in different user groups.

● Other users

Other users are users other than user groups. You can set permissions for files under my users to restrict access to files by other users.

★Relationship between users and user groups

● Assume that there are three users Tom, Marry, and Lass, which belong to the same Tom user group. For some public files, they can be accessed by users in the same user group. This is like four people in the same dormitory. They can share the same bathroom and the same faucet. However, for private files of these three users, you can use the File Permission settings to restrict access by other users. People in the same dormitory can share a restroom, but they cannot view your drawer at will.

★Linux File Attributes


● The first column indicates the file type and permissions.

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

If the first character is [d], it is a directory

If the first character is [-], it is a file

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

In the subsequent characters, the first group is the "file owner's permissions", the second group is the "User Group Permissions", and the third group is the "other non-user group permissions ", images searched from the Internet


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

In Linux, a user may attach one or more user groups. As shown in, all users in the user group have the readable, writable, and executable permissions to the file.

A problem suddenly arises: a user can attach to several user groups at the same time, but for a file, its restriction on user groups is only readable, writable, and executable. What should I do if a user wants to share files in one of multiple user groups ??

● Column 5 shows the size of the file. The default unit is B. ● column 6 shows the file creation date or the latest modification date. ● Column 7 shows the file name.★Importance of file permissions ● data sharing

Users in the same user group can share some files.

● Improper permission settings

If the permission settings are incorrect, some privacy information may be leaked. Or you can set the permissions of some important system files to be accessible by others, which may cause unexpected troubles.

Therefore, before modifying Linux files or directories, you must understand what data is changeable 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.