linux 该变文件拥有者chown,改变文件所属群组chgrp,改变文件权限chmod

 

1. 改变文件所属群组 chgrp 

chgrp [-R] dirname/filename

参数-R: 进行递归(recursive) 的变更。常常用在某一目录内所有的档案。

Examples:
  chgrp staff /u      注:Change the group of /u to "staff".
  chgrp -hR staff /u  注:Change the group of /u and subfiles to "staff".

 

2. 改变文件拥有者 chown

chown [-R] 帐号名称 档案或目录

chown [-R] 帐号名称:群组名称 档案或目录

选项与参数:

-R :进行递归(recursive) 的变更。

EXAMPLES
       chown root /u		注:Change the owner of /u to "root".
       chown root:staff /u	注:Likewise, but also change its group to "staff".
       chown -hR root /u	注:Change the owner of /u and subfiles to "root".

3. 改变文件权限 chmod

chmod [-R] xyz 档案或目录

选项和参数:

 xyz:为rwx 属性数值的相加

-R:为循环(recurive) 递归的变更

档案的权限为:-rwxrwxrwx ,这就个权限是三个三个一组的!其中,我们可以使用数字来代表各种权限,各权限的分数对照如下:

r:4 w:2 x:1

 Example:

[root@www ~]# ls -al .bashrc
-rw-r--r--  1 root root 395 Jul  4 11:45 .bashrc
[root@localhost]# chmod 777 .bashrc
[root@localhost]# ls -al .bashrc
-rwxrwxrwx  1 root root 395 Jul  4 11:45 .bashrc


 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值