linux:文件/目录权限设置
一、权限修改命令:
chmod [OPTION]... MODE[,MODE]... FILE...
二、文件/目录MODE指定方式:
1)、八进制(r=4,w=2,x=1)[root@pinfun6 tmp]# ll filename
-rwxrwxrwx 1 root root 0 Apr 15 14:37 filename
[root@pinfun6 ~]# chmod 0755 filename
[root@pinfun6 tmp]# ls -l filename
-rwxr-xr-x 1 root root 0 Apr 15 14:37 filename
2)、类别范围(u=所有者,g=组,o=其他,a=ugo)[root@pinfun6 tmp]# ll filename
-rwxrwxrwx 1 root root 0 Apr 15 14:37 filename
[root@pinfun6 tmp]# chmod u=r-x[,o=r-x] filename
[root@pinfun6 tmp]# ll filename
-r--rwxrwx 1 root root 0 Apr 15 14:37 filename
3)、只操作某类用户的某类权限(-/+)[root@pinfun6 tmp]# ll filename
-rwxrwxrwx 1 root root 0 Apr 15 14:37 filename
[root@pinfun6 tmp]# chmod g-w,o-w filename
[root@pinfun6 tmp]# ll filename
-rwxr-xr-x 1 root root 0 Apr 15 14:37 filename
[root@pinfun6 tmp]# chmod g+w filename
[root@pinfun6 tmp]# ll filename
-rwxrwxr-x 1 root root 0 Apr 15 14:37 filename
三、修改文件目录的属主、属组
chown [OPTION]... [OWNER][:[GROUP]] FILE...
chgrp [OPTION]... GROUP FILE...
[root@pinfun6 tmp]# chown root filename #修改属主
[root@pinfun6 tmp]# chown :root filename #修改属组
[root@pinfun6 tmp]# chgrp root filename #修改属组
[root@pinfun6 tmp]# chown root:root filename #修改属主和属组
,电脑群:189034526