chmod 777 What do you mean: Brother Bird's Linux private dish The sixth chapter study notes __linux

Source: Internet
Author: User
Tags chmod readable file permissions

Brother Bird's Linux private dishes basic study: Whim decided to look at this book, although it is a very basic thing, but, is definitely not a waste of time, such as I finished reading after finally understand what the meaning of chmod777.

Writing this reading notes is mainly to record some of the commonly used commands, convenient to consult later. Start with the sixth chapter.

The sixth chapter: Linux file permissions and directory configuration

6.1 User and user groups

Basic knowledge not explained, files that record user identities and user group records

The user's information is recorded in the/etc/password

Personal password recorded in/etc/shadow

Group name recorded in/etc/group

6.2 The concept of file permissions This section is more interesting:

View the file's command: Ls-al has this result:

sspeng@sspeng-desktop:~$ Ls-al
Total 135312
Drwxr-xr-x Sspeng Sspeng 4096 Feb 16 22:12.
Drwxr-xr-x 3 root 4096 Feb 7 20:40.
DRWX------3 Sspeng sspeng 4096 Feb. adobe
-RW-------1 Sspeng Feb sspeng 5190 18:44. bash_history
-rw-r--r--1 Sspeng Sspeng Feb 7 20:40. bash_logout
-rw-r--r--1 Sspeng Sspeng 3486 Feb 7 20:40. BASHRC
DRWX------Sspeng Sspeng 4096 Feb. Cache

The first column has 10 characters, representing the file type and permissions

The first character represents whether the file is a directory (d) or a file (-), which is not a file or folder. There are other such as: (l) to indicate linked files and so on and so on.

The next 9 characters are set in 3, all "rwx" combinations, respectively, readable, writable, and executable. The first group is the permissions of the file owner, the second group is the same as the user group, and the third is the permissions of the other non-local user groups. -Indicates no such permission.

For example:-RW-------: Indicates that the owner of this file has read and write, no executable rights, and other users with user groups and non-local user groups do not have any permissions.

The second column indicates how many files are linked to this node

The third column represents the account number of the owner of this file

The fourth column represents the user who owns this file

The Fifth column indicates the file size, in units b

The Sixth column indicates the date of creation or last modification

The seventh column is the filename, where the file that begins with. Represents a hidden file .

Changing the permissions and attributes of a file

CHGRP: Changing the user group to which the file belongs: Chgrp users install.log means to change the user group of the file to users

Chown represents changing the owner of the file Chown bin Install.log means converting the file owner to Bin

chmod: Change file permissions such as chmod 777. BARSHRC means to change this file to all users can read and write executable

So how did 777 come from?

R:4

W:2

X:1

Rwx=4+2+1=7

777 means: The file owner permission is 7, the same permissions as the user group is 7, and the other non-local user group has 7 permissions.

The same can happen with the same command CHMOD740.BARSHRC, this is clear.

Say two more:

chmod u=rwx, Go=rx. BARSHRC in this command, U represents the owner, G represents the user in the group, and O represents the others, which corresponds to the above. Note that Go=rx, where go is spliced, indicates that G and O users have read and execute permissions.

chmod a+w. BARSHRC indicates that all users (a represents all) increase write permissions.

So you should look at the order and not faint.

6.2 also said the meaning of file permissions, very interesting.

For a file

R: Readable, indicating that content can be read

W: writable, which means you can edit content, but you cannot delete files

X: Executable, indicating that the file can be executed.

So how can you delete the file. This is related to directory permissions

R: You can read the file name under the folder

W: You can change the directory list, also means you can create and delete files and directories, you can rename and transfer locations

X: Indicates whether the user can enter the directory to become the working directory. That can be CD in.

So, the directory of W is a very powerful permission , even if you do not allow a user to read and write files, but if you give him the directory of the W permission, then he can delete the file, this may be you do not want to see.

The Fhs:lunux directory configuration standard is also followed. Here are a few pictures to check it out, not all affixed.











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.