Rights management

Why have access to ?
Different permissions are given according to the user's level , Easy to manage ; In practice, it must not be used by all people root jurisdiction , That's not only for the security of the data, but also for the data , So divide the authority into different parts , More conducive to management ; Ordinary operation and maintenance only patrol, I can only give him access to view , People in the development department can give write permission and so on .

r read  4
w Write  2
x perform  1
- No authority  0
u user user
g group Group
o other Other
a all all 

Modify the permissions

-R Change the permissions of sub files and directories by recursion
Number modification
chmod u=rwx,g=rx,o=rx a.sh 
[[email protected] ~]$ chmod u=rwx,g=,o= a.sh
[[email protected] ~]$ chmod 777 a.sh 
[[email protected] ~]$ ll a.sh 
-rwxrwxrwx 1 root root 0 Apr  2 10:53 a.sh
The alphabet changes
[[email protected] ~]$ chmod o-w a.sh 
[[email protected] ~]$ ll a.sh 
-rwxrwxr-x 1 root root 0 Apr  2 10:53 a.sh
[[email protected] ~]$ chmod g-w a.sh 
[[email protected] ~]$ ll a.sh 
-rwxr-xr-x 1 root root 0 Apr  2 10:53 a.sh
[[email protected] ~]$ chmod -x a.sh 
[[email protected] ~]$ ll a.sh 
-rw-r--r-- 1 root root 0 Apr  2 10:53 a.sh
[[email protected] ~]$ chmod +x a.sh 
[[email protected] ~]$ ll a.sh 
-rwxr-xr-x 1 root root 0 Apr  2 10:53 a.sh
[[email protected] ~]$ chmod a-x a.sh 
[[email protected] ~]$ ll a.sh 
-rw-r--r-- 1 root root 0 Apr  2 10:53 a.s

The impact of permissions on files

File permissions influence
r Only the content can be read , Can't write , Cannot perform
w Can add >>; Can cover >; can vim Don't show content ,wq! It'll cover the contents , coordination rw To edit properly .
x Only x, It's no use ; To cooperate r Use
rw Can be read , Can write , Cannot perform .
rx Can be read , Executable , Can't write .
wx Can write , Ordinary users can write , Do not read , It's not executable .
rwx Can be read , Can write , Executable .

notes : Of documents rwx, Only for content , If you want to delete , Or move , So it's related to the permissions of the directory where the file is located .

Impact on catalog

The directory permissions influence
r You can only see the contents of the directory name, but not the details , Can't move files , Can't access the directory
rx You can see the details of the file , Can't move delete .
w Not much use for eggs.
rw You can view the files in the directory , Can't view details ; But you can't delete , Can't move , Can't copy .
wx You can create , You can delete , Can't view
rwx rwx: Delete file , create a file , Moving files , Copy files , see
x x: You can only enter the directory
chown #  How to use
-R  recursive , Change the files in the subdirectory as well .
chown root.root /zls
chown root:root /zls
chown .root /zls
chown :root /zls
chown root. /zls
chown root: /zls