File and folder permission modification under linux
1) Symbol type changes file permissions
Order | modification method | symbol | model |
---|---|---|---|
chmod | u/g/o | +/-/= | r/w/x |
Reference example:
Add x permission to the owner of the file to use chmod u+x file.
Remove r permission to all groups of the file to use chmod gr file.
Others have rx permission to the file to use chmod 0=rx file
2) Number type changes file permissions
The permissions of rwx are: r =4, w=2, x=1
Algorithm: such as r-xr----x [u]=4+0+1=5,[g]=4+0+0 =4, [o]=0+0+1=1
Usage: chmod 541 file1 means to change the permission of this file to r-xr----x
Modifying users and user groups under linux
Use the usermod command to add the user test to the dev user group
Append model: usermod -a -G dev test
Replacement mode: usermod -G dev test
Remove the user test from the dev group
gpasswd -d test dev