你知道linux中如何修改文件权限吗?chmod

1.方法1

chmod [reference][operator][mode] file

解释:

  1. reference:u-ower,g-group, o-others,a-all
  2. operator:+、-、=
  3. mode:r、w、x

例子1

// 将a.txt的 owner的权限设置为 r、w、x
chmod u=rwx a.txt

例子2

// 去掉a.txt的 owner的权限设置为 r权限
chmod u-r a.txt

2.方法2

chomod <owne_number><group_number><other_number> file

权限number的解释:4-read,2-write,1-execute

例子:设置 a.txt的 ower权限为7=4(read)+2(write)+1(execute), group和others的权限为5=4(read)+1(execute)

chmod 755 a.txt

对目录以及包含的所有文件、子目录设置权限

chmod -R [reference][operator][mode] file
或者
chmod -R <owne_number><group_number><other_number> file

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值