Configuration Files for User Management Defaults  

When working with tools as useradd, some default values are assumed. These default values are set in two configuration files: /etc/login.defs and /etc/default/ useradd.

  1. [root@rhel7 ~]# cat /etc/default/useradd
  2. # useradd defaults file
  3. GROUP=
  4. HOME=/home
  5. INACTIVE=-
  6. EXPIRE=
  7. SHELL=/bin/bash
  8. SKEL=/etc/skel
  9. CREATE_MAIL_SPOOL=yes

the /etc/default/useradd file contains some default values that are applied when using useradd.

In the file /etc/login.defs, different login-related variables are set. This file is used by different commands, and it relates to setting up the appropriate environment for new users.

  1. [root@rhel7 ~]# cat /etc/login.defs
  2. #
  3. # Please note that the parameters in this configuration file control the
  4. # behavior of the tools from the shadow-utils component. None of these
  5. # tools uses the PAM mechanism, and the utilities that use PAM (such as the
  6. # passwd command) should therefore be configured elsewhere. Refer to
  7. # /etc/pam.d/system-auth for more information.
  8. #
  9.  
  10. # *REQUIRED*
  11. # Directory where mailboxes reside, _or_ name of file, relative to the
  12. # home directory. If you _do_ define both, MAIL_DIR takes precedence.
  13. # QMAIL_DIR is for Qmail
  14. #
  15. #QMAIL_DIR Maildir
  16. MAIL_DIR /var/spool/mail
  17. #MAIL_FILE .mail
  18.  
  19. # Password aging controls:
  20. #
  21. # PASS_MAX_DAYS Maximum number of days a password may be used.
  22. # PASS_MIN_DAYS Minimum number of days allowed between password changes.
  23. # PASS_MIN_LEN Minimum acceptable password length.
  24. # PASS_WARN_AGE Number of days warning given before a password expires.
  25. #
  26. PASS_MAX_DAYS
  27. PASS_MIN_DAYS
  28. PASS_MIN_LEN
  29. PASS_WARN_AGE
  30.  
  31. #
  32. # Min/max values for automatic uid selection in useradd
  33. #
  34. UID_MIN
  35. UID_MAX
  36. # System accounts
  37. SYS_UID_MIN
  38. SYS_UID_MAX
  39.  
  40. #
  41. # Min/max values for automatic gid selection in groupadd
  42. #
  43. GID_MIN
  44. GID_MAX
  45. # System accounts
  46. SYS_GID_MIN
  47. SYS_GID_MAX
  48.  
  49. #
  50. # If defined, this command is run when removing a user.
  51. # It should remove any at/cron/print jobs etc. owned by
  52. # the user to be removed (passed as the first argument).
  53. #
  54. #USERDEL_CMD /usr/sbin/userdel_local
  55.  
  56. #
  57. # If useradd should create home directories for users by default
  58. # On RH systems, we do. This option is overridden with the -m flag on
  59. # useradd command line.
  60. #
  61. CREATE_HOME yes
  62.  
  63. # The permission mask is initialized to this value. If not specified,
  64. # the permission mask will be initialized to .
  65. UMASK
  66.  
  67. # This enables userdel to remove user groups if no members exist.
  68. #
  69. USERGROUPS_ENAB yes
  70.  
  71. # Use SHA512 to encrypt password.
  72. ENCRYPT_METHOD SHA512

Here is a list of some of the most significant properties that can be set from /etc/login.defs:

■    MOTD_FILE:     Defines the file that is used as “message of the day” file. In this file, you can include messages to be displayed after the user has successfully logged in to the server.    
 ■    ENV_PATH:     Defines the $PATH variable, a list of directories that should be searched for executable files after logging in.    
 ■    PASS_MAX_DAYS, PASS_MIN_DAYS, and PASS_WARN_AGE:     Define the default password expiration properties when creating new users.    
 ■    UID_MIN:     The first UID to use when creating new users.    
 ■    CREATE_HOME:     Indicates whether or not to create a home directory for new users.    
 ■    USERGROUPS_ENAB:     Set to yes to create a private group for all new users. That means that a new user has a group with the same name as the user as its default group. If set to no, all users are made a member of the group users.

与useradd命令相关的两个默认配置文件的更多相关文章

  1. useradd 命令 及 相关文件解读

    翻译自 man useradd 名称: 创建新用户或更新默认的新用户信息 快照:useradd -D 描述: 在不加-D参数调用时,useradd命令使用指定的参数和系统的默认值来创建新账户. 取决于 ...

  2. linux useradd 命令基本用法

    在 Linux 中 useradd 是个很基本的命令,但是使用起来却很不直观.以至于在 Ubuntu 中居然添加了一个 adduser 命令来简化添加用户的操作.本文主要描述笔者在学习使用 usera ...

  3. Linux中exec命令相关

    Linux中exec命令相关 exec和source都属于bash内部命令(builtins commands),在bash下输入man exec或man source可以查看所有的内部命令信息. b ...

  4. linux命令详解之useradd命令

    useradd命令使用方法,还包括用户账号的添加.删除与修改.用户口令的管理.用户组的管理方法. Linux系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申 ...

  5. Linux指令--性能监控和优化命令相关指令

    原文出处:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html.感谢作者无私分享 性能监控和优化命令相关指令有:top,free,v ...

  6. useradd 命令的常见用法

    在Linux系统中 useradd 是个很基本的命令,但是使用起来却很不直观.以至于在 Ubuntu 中居然添加了一个 adduser 命令来简化添加用户的操作.本文主要描述笔者在学习使用 usera ...

  7. linux命令详解之useradd命令使用方法[linux下 添加用户、删除用户、修改用户密码、用户组管理]

    http://www.jb51.net/article/45848.htm Linux 系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这 ...

  8. (转)linux命令详解之useradd命令使用方法

    linux命令详解之useradd命令使用方法 原文:http://blog.csdn.net/u011537073/article/details/51987121 Linux 系统是一个多用户多任 ...

  9. Linux 中useradd命令的使用

    Linux 系统中通常都是root用户具有超级权限,超级用户root一般是不需要创建的,然而很多时候root用户不是任何人都可以使用的,毕竟最高权限的用户,任意使用的话,会对系统造成很多不必要的破坏. ...

随机推荐

  1. 使用Eclipse创建Hibernate工程

    创建一个java project项目,加入hibernate的jar包和数据库驱动包,并引入到项目.

  2. jquery 的日期时间控件(年月日时分秒)

    <!-- import package --> <script type="text/javascript" src="JS/jquery.js&quo ...

  3. 关于$_SERVER 常量 HTTP_X_FORWARDED_HOST与 HTTP_HOST的问题

    今天在看ecshop的源码,发现了用$_SERVER['HTTP_X_FORWARDED_HOST']来判断主机的地址,就目前来说很多人都是直接通过$_SERVER['HTTP_HOST']来判断的, ...

  4. Flask学习记录之Flask-Login

    Flask-Loging 可以方便的管理用户会话,保护路由只让认证用户访问 http://flask-login.readthedocs.org/en/latest/ 一.初始化Flask-Login ...

  5. Automatically watermark all uploaded photos (给所有上传的相片加水印)

    Hello, This mod automatically watermark all uploaded photos. Price: FREE, enjoy. You will have to ed ...

  6. FPGA同步复位异步复位

    今天看了篇博客, 是拿altera的芯片和软件作例子的,讲同步异步复位的: http://blog.sina.com.cn/s/blog_bff0927b0101aaii.html 还有一个博客, h ...

  7. "类名.this"与"this"的区别

    "this"是指(或者说:所代表的是)当前这段代码所在的类的对象.而"类名.this"是指"类名"的对象(一般在匿名类或内部类中使用来调用外 ...

  8. 转:精心挑选的12款优秀 jQuery Ajax 分页插件和教程

    在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 Web 项目的用户体验有了极大的提高,如今借助优秀的  ...

  9. 转:MongoDB调查总结

    与关系型数据库相比,MongoDB的优点:①弱一致性(最终一致),更能保证用户的访问速度:举例来说,在传统的关系型数据库中,一个COUNT类型的操作会锁定数据集,这样可以保证得到“当前”情况下的精确值 ...

  10. c/c++关于内存分配的知识(非常详细的比较,且VirtualAlloc分配内直接在进程的地址空间中保留一快内存)

    一个由c/C++编译的程序占用的内存分为以下几个部分 1.栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等.其操作方式类似于数据结构中的栈. 2.堆区(heap) — 一 ...