zoukankan      html  css  js  c++  java
  • linux基础命令-chgrp/chown/chomd

    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]# 

                

  • 相关阅读:
    4.8日学习
    Apache安装
    HTML5 review
    个人阅读作业LAST
    个人阅读作业Week7
    结对编程:界面模块总结
    个人博客作业Week3
    结对编程博客
    个人博客week2
    软工第一次作业简单总结
  • 原文地址:https://www.cnblogs.com/me80/p/7407048.html
Copyright © 2011-2022 走看看