• 文件权限符号:drwxr-xr-x
      • 权限的首位字符
          • 普通文件
        • d 目录
        • l 链接
      • 分三组权限
        • 前3位表示所属用户 - u
        • 中间3位表示所属用户组 - g
        • 后3位表示其他用户组 - o
        • a表示所有用户跟组的权限
      • 权限rwx的意义
        • 权限 r 或数字 4 — 表示可读权限
        • w 或数字 2 — 表示可写权限
        • x 或数字 1 — 表示可执行
    • 语法
      • chmod u+x hello.txt 为 hello.txt 文件所有者添加可执行权限
      • chmod u-w hello.txt 为 hello.txt 文件所有者去除可执行权限
      • chmod g-r hello.txt 为 hello.txt 文件所在组去除可读权限
      • chmod o+w hello.txt 为 hello.txt 文件的所在组的其它组添加可写权限
      • chmod a+w hello.txt 为所有三种角色添加可写权限
      • chmod a+wx hello.txt 为所有三种角色添加可写权限
      • chmod a-rwx hello.txt 去除 hello.txt 的所有权限(此时仅 root 可编辑)
      • chmod 777 hello.txt 将 hello.txt 的权限设为 rwxrwxrwx
      • chmod 643 hello.txt 将 hello.txt 的权限设为 rw-r—-wx
      • chmod 777 /opt/test 将目录/opt/test 的权限更改为 777
      • chmod -R 755 /opt/test 将目录/opt/test 及其下所有文件和子目录的权限更改为 755