• linux之/etc/default/useradd文件


    /etc/default/useradd文件是在使用useradd添加用户时,一个需要调用的默认的配置文件之一,可以使用命令"useradd -D"进行修改。

    useradd用法:

    1. [root@centos79-3 mail]# useradd --help
    2. Usage: useradd [options] LOGIN
    3. useradd -D
    4. useradd -D [options]
    5. Options:
    6. -b, --base-dir BASE_DIR base directory for the home directory of the
    7. new account
    8. -c, --comment COMMENT GECOS field of the new account
    9. -d, --home-dir HOME_DIR home directory of the new account
    10. -D, --defaults print or change default useradd configuration
    11. -e, --expiredate EXPIRE_DATE expiration date of the new account
    12. -f, --inactive INACTIVE password inactivity period of the new account
    13. -g, --gid GROUP name or ID of the primary group of the new
    14. account
    15. -G, --groups GROUPS list of supplementary groups of the new
    16. account
    17. -h, --help display this help message and exit
    18. -k, --skel SKEL_DIR use this alternative skeleton directory
    19. -K, --key KEY=VALUE override /etc/login.defs defaults
    20. -l, --no-log-init do not add the user to the lastlog and
    21. faillog databases
    22. -m, --create-home create the user's home directory
    23. -M, --no-create-home do not create the user's home directory
    24. -N, --no-user-group do not create a group with the same name as
    25. the user
    26. -o, --non-unique allow to create users with duplicate
    27. (non-unique) UID
    28. -p, --password PASSWORD encrypted password of the new account
    29. -r, --system create a system account
    30. -R, --root CHROOT_DIR directory to chroot into
    31. -P, --prefix PREFIX_DIR prefix directory where are located the /etc/* files
    32. -s, --shell SHELL login shell of the new account
    33. -u, --uid UID user ID of the new account
    34. -U, --user-group create a group with the same name as the user
    35. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
    36. [root@centos79-3 mail]#

    /etc/default/useradd文件

    1. [root@centos79-3 default]# pwd
    2. /etc/default
    3. [root@centos79-3 default]# cat useradd
    4. # useradd defaults file
    5. GROUP=100
    6. HOME=/home
    7. INACTIVE=-1
    8. EXPIRE=
    9. SHELL=/bin/bash
    10. SKEL=/etc/skel
    11. CREATE_MAIL_SPOOL=yes
    12. [root@centos79-3 default]#
    /etc/default/useradd文件说明
    key=value说明
    GROUP=100 用户默认GID.若是在添加新用户的时候没有指定GID,那么Linux系统有两种做法:一是把它添加到统一的组里面,就是这里的这个组;二是添加到和用户UID同名的GID中,即创建一个新的组且GID=HID.但是这些都不是可取的,最好的方法是每添加一个用户都应该想好,这个用户是属于那个部门(组)的,不应该出现一个不知道该放哪一个组的用户。
    HOME=/home指定缺省宿主目录存放的目录
    INACTIVE=-1账户是否被禁用 -1:不禁用  0:禁用
    EXPIRE= 账号失效时间,比如临时加入该项目的成员,添加临时账户,那么项目完成后就让这些临时账户失效;不设置表示永久有效
    SHELL=/bin/bash缺省使用的shell
    SKEL=/etc/skel新用户宿主目录下的文件存放路径
    CREATE_MAIL_SPOOL=yes新用户是否要创建一个和用户同名的保存邮件信息的文件

  • 相关阅读:
    LeetCode每日一练 —— 21. 合并两个有序链表
    计算机网络
    命令行git联网失败,但是实际可以联网
    《设计模式》之迭代器模式
    再创佳绩!移远通信RG500U-EA 5G模组获得全球首个紫光展锐V510平台GCF 认证
    网络安全--IDS--入侵检测
    第五届芜湖机器人展,正运动助力智能装备“更快更准”更智能!
    kafka 自定义Interceptor(通过拦截器对消息进行定制化处理)
    专业招投标书翻译怎样做比较好
    三个神仙电脑端的工具,快进来看看你知不知道这些工具
  • 原文地址:https://blog.csdn.net/z19861216/article/details/133220736