|
1. Linux file access permissions
chmod change mode is an abbreviation. Similarly chown is an abbreviation for change owner, is access to a file changes, a change in the owner of the file.
2. Change the file permissions chmod
Linux file concerned, access permissions and file owner is more important of the two properties. Access to files about such a concept. Such as access to files and 3, a read, read by said flag is 4, is a writing, with w, said flag is 2, and the other is x, flag is 1, that means executable (for a file, x represents the file can be executed, for a directory, x indicates the directory can be accessed, which can go cd). For a given user, if the mode value of a document is 7, then this indicates that the user has rwx file permissions. This is the bit operation, hoping to carefully understand what. Where 755 represents the owner of the file permissions are rwx (read and write access or execute), group_user permissions on this file is rx, others permissions on this file is rx (read and execute access).
chmod -R 755 *
We are usually listed a 3-digit number by ll command or ls -al, how this understanding it. This is the original, and this three-digit represent owner group_user others permissions on this file, the root causes of this shows that Linux is a multi-user operating system, a file can be different users see. Group_user and necessary to explain the concept in Linux, and users can group, and a group can turn multiple users, so that a document should be noted that these three types of user access to the file is considered complete, otherwise, when a file exposed to different types of users, the operating system how it will deal with this case? The above problems are basically file permissions, this knowledge, you can set the appropriate permissions to a file, if it is a directory, if you want to recursively set permissions for each file directory, you can use the -R argument .
3. Change the file attributes chown user group
Here is chown related content.
Each file has an owner, the owner is a user through a group and to jointly decide. If you do not know your identity, you can view by whoami. If you do not know your current group, groups can be used to view all the group.
These two scenarios are usually practical tools like this, you do not want to edit a file when always use sudo, this document does not need to be protected, one way is to access the file permissions set to 777, so that everyone It can be freely modified without any protection. But in another way the owner of the file is set to your current user, or that you want him to feel free to edit this file without any user restrictions. Thus for example,
chown -R work: work *.
This can be all files in the current directory are set to work work, the first work is the user name, the second is the user group. Under normal circumstances is the same. If you are not sure, you can touch a file, then ls -al, so look for new files are listed and the user group, set the same, you can always cancel the password input trouble. |
|
|
|