zoukankan      html  css  js  c++  java
  • chown chmod chgrp chattr chroot usermod 命令简单分析


    chown
    用于修改文件或目录的所属主与所属组,格式为:“chown [参数] 所属主:所属组 文件或目录名称”。
    [root@localtion ~]# chown root:bin test
    [root@localtion ~]# ls -l test
    -rwxrw----. 1 root bin 15 Feb 11 11:50 test

    chmod
    chmod命令用于修改文件或目录的权限,格式为:"chmod [参数] 权限 文件或目录名称"。
    [root@localtion ~]# chmod 760 test
    [root@localtion ~]# ls -l test
    -rwxrw----. 1 root root 15 Feb 11 11:50 test

    chgrp
    用于设置文件所归属的组的命令。
    与chown命令不同,chgrp允许普通用户改变文件所属的组,只要该用户是该组的一员。

    chattr
    用于设置文件的隐藏权限,格式为:“chattr [参数] 文件”。
    [root@localtion ~]# echo "for Test" > hello
    [root@localtion ~]# chattr +a hello
    [root@localtion ~]# rm hello
    rm: remove regular file ‘hello’? y
    rm: cannot remove ‘hello’: Operation not permitted

    chroot
    改变根目录。
    补充说明:把根目录换成指定的目的目录。

    usermod
    修改用户帐号。
    补充说明:usermod可用来修改用户帐号的各项设定。
    参  数:
     -c<备注>  修改用户帐号的备注文字。
     -d登入目录>  修改用户登入时的目录。
     -e<有效期限>  修改帐号的有效期限。
     -f<缓冲天数>  修改在密码过期后多少天即关闭该帐号。
     -g<群组>  修改用户所属的群组。
     -G<群组>  修改用户所属的附加群组。
     -l<帐号名称>  修改用户帐号名称。
     -L  锁定用户密码,使密码无效。
     -s<shell>  修改用户登入后所使用的shell。
     -u<uid>  修改用户ID。
     -U  解除密码锁定。

    mount -o remount,rw /sysroot 重新挂载一个已经挂载好的目录,并修改其权限

  • 相关阅读:
    .NET 使用EF执行存储过程你知道几种?
    SQLserver 如何优雅的行转列
    SQLserver 如何获取近1月、近3个月、近6月数据
    三汇自动挂断问题:SIP兼容性,ACK检测,忽略ACK开启。
    几个flutter 开源项目测试
    Android versions for all users globally
    Using Flutter 2 on M1 MacOS Apple Silicon
    Educational Codeforces Round 111
    Wannafly挑战赛1
    摆烂记录
  • 原文地址:https://www.cnblogs.com/helloworldPC/p/6933207.html
Copyright © 2011-2022 走看看