Summary of
common rights of linux, mark it
Commonly used linux file permissions as follows:
444 r--r--r-- 600 rw------- 644 rw-r--r-- 666 rw-rw-rw- 700 rwx------ 744 rwxr--r-- 755 rwxr-xr-x 777 rwxrwxrwx
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
从左至右,先是3个数字,代表文件的权限
然后是9个字母(或者连字符)
其中 1-3位数字代表文件所有者的权限
4-6位数字代表同组用户的权限
7-9数字代表其他用户的权限
而具体的权限是由数字来表示的
读取的权限等于4,用r表示
写入的权限等于2,用w表示
执行的权限等于1,用x表示
通过4、2、1的组合,得到以下几种权限:
0(没有权限);4(读取权限);5(4+1 | 读取+执行);6(4+2 | 读取+写入);7(4+2+1 | 读取+写入+执行)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
To 754 as an example:
1-3 Bit 7 is equal to 4 + 2 + 1, rwx, owners have read, write, execute permissions;
4-6 5 equals 4 + 1 + 0, rx, the same group of users have read, execute permission, but no write access;
7-9 bits 4, but no other users have read and write permissions to execute permissions
Change file permissions command
chmod 权限数字(如777) filename
Permissions command to change all of the files in the directory
chmod -R 权限数字(如777) 目录(如/home)