码迷,mamicode.com
首页 > 系统相关 > 详细

linux基础命令-chgrp/chown/chomd

时间:2017-08-21 22:57:39      阅读:392      评论:0      收藏:0      [点我收藏+]

标签:inux   chown   目录   file   linux基础命令   chgrp   16px   名称   not found   

chgrp 改变所属用户组

要被改变的组名必须要在/etc/group文件内存在才行;

chgrp [-R]   dirname/filename

-R:进行递归的持续更改,连同子目录下的所有文件、目录都更新为新的用户组

chown 改变文件所有者

如果要连目录下的的所有子目录或文件 都同时更改文件所有者的话,直接加上-R参数即可

chown  [-R]  账号名称                   文件或目录

chown [-R]   账号名称组名          文件或目录

chown [-R]  账号名称.组名           文件或目录

chmod  改变权限

数字类型改变文件权限

[root@host01 tmp]# ll
total 4
drwxr-xr-x. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod 000  foo/
[root@host01 tmp]# ls
foo
[root@host01 tmp]# ll
total 4
d---------. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod 777 foo/
[root@host01 tmp]# ll
total 4
drwxrwxrwx. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod 641 foo/
[root@host01 tmp]# ls
foo
[root@host01 tmp]# ll
total 4
drw-r----x. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod 755 foo/
[root@host01 tmp]# ll
total 4
drwxr-xr-x. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# 

符号类型改变文件权限

[root@host01 tmp]# chmod  u=rwx,g=rw,o=rw  /tmp/foo/
[root@host01 tmp]# ll
total 4
drwxrw-rw-. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod  u=rx,g+x,o-rw  /tmp/foo/
[root@host01 tmp]# ll
total 4
dr-xrwx---. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod  ugo=rw  /tmp/foo/
[root@host01 tmp]# l
-bash: l: command not found
[root@host01 tmp]# ll
total 4
drw-rw-rw-. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# chmod  ug=rw,o-rw  /tmp/foo/
[root@host01 tmp]# ll
total 4
drw-rw----. 2 root root 4096 Aug 22 06:11 foo
[root@host01 tmp]# 

 

            

linux基础命令-chgrp/chown/chomd

标签:inux   chown   目录   file   linux基础命令   chgrp   16px   名称   not found   

原文地址:http://www.cnblogs.com/me80/p/7407048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!