Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

14.3. 访问权限

Access Permissions

14.3.1. umask

			
[root@development ~]# umask
0022
[root@development ~]# umask -S
u=rwx,g=rx,o=rx		
			
			

设置

			
umask 002
			
			

14.3.2. chown - change file owner and group

chown - change file owner and group

		
[root@netkiller ~]# touch netkiller
[root@netkiller ~]# adduser neo
[root@netkiller ~]# chown neo netkiller
[root@netkiller ~]# ll netkiller
-rw-r--r-- 1 neo root 0 Apr 19 18:15 netkiller
			
			

14.3.3. chgrp - change group ownership

chgrp - change group ownership

		
# chgrp daemon -R *

# ll
drwxrwxr-x  3 neo  daemon      4096 Apr 16 18:23 user 		
			
			

14.3.4. chmod - change file access permissions

option

		
u = user
g = group
o = other
a = all

r = 4
w = 2	
x = 1
			
			
		
[root@netkiller ~]# ll netkiller
-rwxr--r-- 1 neo root 0 Apr 19 18:15 netkiller
[root@netkiller ~]# chmod g=x netkiller
[root@netkiller ~]# ll netkiller
-rwx--xr-- 1 neo root 0 Apr 19 18:15 netkiller
[root@netkiller ~]# chmod go+w netkiller
[root@netkiller ~]# ll netkiller
-rwx-wxrw- 1 neo root 0 Apr 19 18:15 netkiller
[root@netkiller ~]# chmod u-wx netkiller
[root@netkiller ~]# ll netkiller
-r---wxrw- 1 neo root 0 Apr 19 18:15 netkiller
[root@netkiller ~]# chmod u=rwx netkiller
[root@netkiller ~]# ll netkiller
-rwx-wxrw- 1 neo root 0 Apr 19 18:15 netkiller
[root@netkiller ~]# chmod a=rwx netkiller
[root@netkiller ~]# ll netkiller
-rwxrwxrwx 1 neo root 0 Apr 19 18:15 netkiller