设置 UNIX 权限
要更改一个项目的权限,可以使用 chmod 命令。 该命令的语法如下:
chmod securitygroup [changetype] [permission] [file or directory]
命令中每个项目的选项说明如下:
Securitygroup(要更改其权限的人或分组)
- u - 用户
- g - 分组
- o - 其他人
- all - 所有人
Changetype(要增加权限还是减少权限。)
- “+” 添加权限
- “-” 减少权限
Permission(要更改的权限)
- r - 读
- w - 写
- x - 执行
File or directory:要更改的文件或目录的名称
示例:
chmod go-w myfile 删除 group 和 others 对文件 myfile 的读访问权限。
chmod go+rw myfile1 myfile2 增加 group 和 others 对文件 myfile1 和 myfile2 的读和写访问权限。
chmod ugo+rwx myfile1 增加 everyone 对 myfile1 的读、写和执行权限。
有关更改 UNIX 权限的更多信息,请输入以下命令,参阅 chmod 手册页面:man chmod