zoukankan      html  css  js  c++  java
  • linux用户管理

    1.删除用户 userdel:

      userdel [option] USERNAME

        默认不会删除用户的家目录

        -r  同时删除家目录

      id:查看用户的账号属性信息

        -u  -g   -G  -n

         -g, --group
                  print only the effective group ID
    
           -G, --groups
                  print all group IDs
    
           -n, --name
    

    2.修改用户账号属性

     usermod

      -g, --gid GROUP
               The group name or number of the user?s new initial login group. The group must exist.
         -u, --uid UID
               The new numerical value of the user´s ID.

       -G, --groups GROUP1[,GROUP2,...[,GROUPN]]] 附加组
               If the user is currently a member of a group which is not listed, the user will be removed from the group.
               This behaviour can be changed via the -a option, which appends the user to the current supplementary group
               list.(-a 不删除之前的附加组)

       -c, --comment COMMENT
               The new value of the user´s password file comment field. It is normally modified using the chfn(1) utility.

           -d, --home HOME_DIR(为用户指定新的家目录,原来的家目录就无法访问了)
               The user´s new login directory.

               If the -m option is given, the contents of the current home directory will be moved to the new home
               directory, which is created if it does not already exist. If the current home directory does not exist the
               new home directory will not be created(移动此前的文件至新的家目录中去和-m一起使用)

        -l, --login NEW_LOGIN
               The name of the user will be changed from LOGIN to NEW_LOGIN. Nothing else is changed. In particular, the
               user´s home directory or mail spool should probably be renamed manually to reflect the new login name.

       -L, --lock
               Lock a user´s password.
      
           -U, --unlock
               Unlock a user´s password. This removes the ´!´ in front of the encrypted password. You can´t use this option
               with -p or -L.

    cnfn:修改注释信息

    3.密码管理:

      passwd [USERNAME]

      如果使用脚本自动怎么改呢(linux重要哲学思想之一:避免捕获用户接口)

      --stdin  echo "redhat" | passwd --stdin

    [root@good eric ~]# echo "root1"|passwd --stdin test
    Changing password for user test.
    passwd: all authentication tokens updated successfully.
    [root@good eric ~]# 
    

         -l   锁定密码

        -u   解锁

                -n

        -w

         -i

         -d 删除用户密码
    PAM:

     pwck:检查用户账号完整性

    4.组管理

        创建组:groupadd

              -g  指定gid

              -r  添加一个系统组(id1-499)
        修改组:groupmod

              -g 修改组名

              -n groupname

        给组设定密码:gpasswd

          更改用户的基本组newgrp  GROUPNAME<--->exit







             

  • 相关阅读:
    hdu 4144 状态压缩dp
    hdu 4118 树形dp
    hdu 4115 2-SAT判定
    hdu 4085 斯坦纳树
    hdu 3311 斯坦纳树
    hdu 4081 最小生成树+树形dp
    hdu 4424 并查集
    洛谷P2661信息传递
    洛谷P2746校园网
    树状数组模板
  • 原文地址:https://www.cnblogs.com/jycjy/p/6855229.html
Copyright © 2011-2022 走看看