zoukankan      html  css  js  c++  java
  • 关于linux用户管理常用选项

    1.用户信息表/etc/passwd

     1   [centos@ecs-cdb9 ~]$ cat /etc/passwd
     2   root:x:0:0:root:/root:/bin/bash
     3     
     4 字段信息:
     5     ACCOUNT:用户名
     6     PASSWORD:密码占位符   # x  真正的密码文件在/etc/shadow 
     7     UID:用户ID        # root 是0  普通用户500-65535 系统用户1-499
     8     GID:用户组ID
     9     COMMAND:注释信息
    10     HOME DIR:用户家目录
    11     SHELL:用户的默认 shell

    2.常用命令

     1 useradd :添加用户
     2     -u uid   # >500
     3     -g gid
     4     -G 指定多个组
     5     -c    注释信息
     6     -d    用户的家目录
     7     -s    指定shell
     8     -M    不创建家目录
     9     -m    没有就创建家目录
    10 userdel:删除用户
    11 usermod:修改用户信息,跟usermod类似不在赘述
    12 #####
    13 id:显示账号属性信息
    14 passwd :改密码   
    15     --stdin:  #echo "newpassword" | passwd --stdin centos
    常用用户命令

    3.关于用户创建的过程

    1 [centos@ecs-cdb9 ~]$ ll -a /etc/skel/
    2 total 28
    3 drwxr-xr-x.  2 root root  4096 Dec 25 10:53 .
    4 drwxr-xr-x. 98 root root 12288 May 15 10:11 ..
    5 -rw-r--r--.  1 root root    18 Mar  6  2015 .bash_logout
    6 -rw-r--r--.  1 root root   193 Mar  6  2015 .bash_profile
    7 -rw-r--r--.  1 root root   231 Mar  6  2015 .bashrc
    8 
    9 useradd创建时,会同时cp  /etc/skel/这个目录下的内容
    过程

    4.修改过期时间

    chage:密码失效是通过此命令来管理的。
    
      参数意思:
      -m 密码可更改的最小天数。为零时代表任何时候都可以更改密码。
      -M 密码保持有效的最大天数。
      -W 用户密码到期前,提前收到警告信息的天数。
      -E 帐号到期的日期。过了这天,此帐号将不可用。
      -d 上一次更改的日期
      -i 停滞时期。如果一个密码已过期这些天,那么此帐号将不可用。
      -l 例出当前的设置。由非特权用户来确定他们的密码或帐号何时过期。
    [root@ecs-cdb9 ~]# chage -l root
    Last password change                    : Mar 30, 2018
    Password expires                    : never
    Password inactive                    : never
    Account expires                        : never
    Minimum number of days between password change        : 0
    Maximum number of days between password change        : 99999
    Number of days of warning before password expires    : 7
    
    默认创建时的用户配置信息
    [centos@ecs-cdb9 ~]$ egrep -v  "^#|^$"  /etc/login.defs
    MAIL_DIR    /var/spool/mail
    PASS_MAX_DAYS    99999
    PASS_MIN_DAYS    0
    PASS_MIN_LEN    5
    PASS_WARN_AGE    7
    UID_MIN                  1000
    UID_MAX                 60000
    SYS_UID_MIN               201
    SYS_UID_MAX               999
    GID_MIN                  1000
    GID_MAX                 60000
    SYS_GID_MIN               201
    SYS_GID_MAX               999
    CREATE_HOME    yes
    UMASK           077
    USERGROUPS_ENAB yes
    ENCRYPT_METHOD SHA512
    过期时间
  • 相关阅读:
    Oracle等待事件Enqueue CI:Cross Instance Call Invocation
    Exadata. Are you ready?
    Beyond the Mobile Goldrush
    推荐一款性能诊断工具Membai
    Does LGWR use synchronous IO even AIO enabled?
    Raid Level,该如何为Oracle存储选择才好?
    Oracle备份恢复:Rman Backup缓慢问题一例
    Usage and Configuration of the Oracle shared Server
    UserManaged Backups
    Oracle Recovery Manager Overview and Configuration
  • 原文地址:https://www.cnblogs.com/bulvlanshan/p/9039532.html
Copyright © 2011-2022 走看看