chmod命令用于更改文件的权限,其语法格式如下:
chmod [选项] mode 文件
常用参数:
-R :级联修改
mode模式:
文件的权限表示为:属主 属组 其他人,可读可写可执行,rwx 421,字母mode和数字mode;
演示示例:
[root@master ~]# chmod u+x,g+w,o+w /root/text.txt
[root@master ~]# chmod a-x /root/text.txt
[root@master ~]# chmod u=rwx,g=r,o=r-x file1
[root@master ~]# chmod 766 /root/text.txt
[root@master ~]# chmod -R 777 /usr/local/nginx #-R表示级联,一般对目录来操作