Different users have different operation rights for different files and folders, in order to ensure data security and system security! Control users' operation rights
RWX
R read permission to read content, files can read content, folders can be ls ll
W write permission File can write content to file Folder can mkdir touch cp mv
X execute execution right shell script file execution right, code execution program in running file X must be in the folder
note:
Root is a super administrator, not under permission control, and can assign permissions
1 File permissions
1.1 Add user useradd username
The root administrator can add user useradd
1.2 Switch users
su username
on zss
User logout
[zss@localhost /]$ exit
exit
[root@localhost ~]#
1,3 Permission demo
- rw- r-- r--
File permissions of the current user's permissions group permissions of others (read)
zss has r permission to /1.txt belonging to other people--only read permission, so
[zss@localhost /]$ cat 1.txt
hello zss
[zss@localhost /]$ echo "zai" >> 1.txt
bash: 1.txt: Permission denied No write permission
Root can assign permissions, rootgeizss assigns write permissions
chmod o+w /1.txt
1.4 Permission modification root administrator control permissions
method one
chmod ugo+/-rwx file name
Way two
chmod 777 file
u g o
RWX RW- R-X
111 110 101
7 6 5
chmod 765 /1.txt
2 Folder permissions
As long as the folder must have X permissions, otherwise RW is invalid
R can read ls ll
W mv cp mkdir rm touch echo
Pay attention to the parameters
-R recursively modify all permissions under the folder