1. Linux File access rights
chmod
is the abbreviation for change mode. The chown
same is the abbreviation for change owner, one that changes the access rights of the file, and one that changes the owner of the file.
2. Change file access Permissions chmod
For Linux
files, access rights and the owner of the file are two more important properties. Access to a file is probably a concept. For example, the access rights of the file 3, one is read, with read, the flag bit is 4, one is write, with W, the flag bit is 2, the other is X, the flag bit is 1, indicates the executable meaning (for a file, x indicates that the file can be executed, for a directory, x indicates that the directory can be accessed, That can be CD-in). For a given user, if the mode value of a file is 7, then the user is rwx to the file. This is a bitwise operation, and I hope we can understand it carefully. 755 of these indicate that owner's permission to this file is rwx (read/write execution or access), group_user the permission to the file is rx,others the permission to the file is Rx (read and write execution and access).
chmod755 *
What do we do with a 3-digit number that is usually listed by the LL command or Ls-al? This is the case, this three-digit number represents the owner group_user others
permissions on this file, which means that the root is Linux
a multi-user operating system, a file can be seen by different users. It is also necessary to explain group_user
this concept, in Linux
, the user is can also group, a group can have multiple users, so a file needs to explain that the 3 types of user access to the file is complete, otherwise, when a file exposed to different types of users, How can the operating system handle this case? The above basic is the problem of file permissions, know this knowledge, you can give a file to set the appropriate permissions, if it is a directory, if you want to recursively set the directory of each file permissions, you can use the-r parameter.
3. Change the file user group Properties Chown
The following are chown related content.
Each file has an owner, and the owner is determined by a group and a user. If you do not know your identity, you can use WhoAmI to view. If you do not know your current group, you can use groups to see all the group.
The usual practical scenario for these two tools is that you don't want to always use sudo when editing a file, and this file is not necessarily protected, one way is to set the file access to 777 so that everyone can modify it without any protection. But the other way is to set the owner of the file to be your own current user, or you want him to be free to edit the file without being restricted by any user. such as this
chown-Rwork:work .*
This allows all files under the current directory to be set to work, the first work is the user name, and the second is the user group. In general, the same is true. If you do not know, you can touch a file, and then ls -al
, so look at the new files listed below the user and group, set to the same, you can cancel the lost password always trouble.
Linux file Permissions chmod chown