【Permissions】
In the ubuntu system, different users and users in different user groups have different operation permissions on files. We can quickly operate on file permissions through the console.
There are two schemes to modify permissions for modifying permissions. Here is an understanding of the composition of file system permissions:
File permission view:
1、 View file permissions command: ls -lh [option:file name]
2、 View folder permissions command ls -ld [option: folder name]
Example: -rw-r–r–
Explanation:-(representative type) ××× (owner) ××× (group users) ××× (other users)
Option One:
Now use the chmod command to modify the file permissions
sudo chmod 600 ××× (Only the file owner has read and write permissions)
sudo chmod 644 ××× (The file owner has read and write permissions, and group users have only read permissions)
sudo chmod 700 ××× (Only the file owner has read, write and execute permissions)
sudo chmod 666 ××× (all users have read and write permissions)
sudo chmod 777 ××× (all users have read and write and execute permissions)
Explanation:
1、 Where ×××: refers to the file name (when modifying the folder permissions, some need to add -ld after chmod)
2、 The three digits correspond to the permission settings of each user type, and the value is 0-7, that is, binary [000]~[111].
3、 Other permissions [000] No permissions [100] Read-only permissions [110] Read-write permissions [111] Read-write permissions
Option II:
Also use the chmod command to modify permissions, as follows:
**Command format: **
sudo chmod [Operation object + Increase/decrease of authority + Operation authority]
example:
sudo chmod u+w ××× #Add the "writable" permission of the file owner
sudo chmod u-w ××× # Delete the "writable" permission of the file owner
sudo chmod g+r ××× #Add "read" permission for user group
sudo chmod o-r ××× # delete other users' "writable" permission
sudo chmod +x ××× #Add "executable" permission for all users
Explanation:
Operation object: u means the file owner, g means group users, o means other users, a means all users
Increase or decrease of permissions: + means to increase permissions,-to cancel permissions, = to set unique permissions
Operation authority: r means readable, w means writable, x means executable
The above article on how to add/delete file permissions under Linux (ubuntu) is all that I have shared with you. I hope to give you a reference.
Recommended Posts