A configuration file that relates to the user environment but is used completely in the background is /etc/login.defs. In this configuration file, some generic settings are defined. These settings determine all kinds of things relating to user login. This file is a readable configuration file that contains variables relating to logging in or to the way certain commands are used. On every system, this file must exist, because otherwise you will see unexpected behavior. Some of the most interesting variables you can use in this file are as follows. For a complete overview, consult man 5 login.defs.
CHARACTER_CLASS: This variable defines what characters you can use in a username or group name. By default, this includes all alphanumeric characters.
DEFAULT_HOME: By default, a user will be allowed to log in, even if his home directory does not exist. If you don't want that, modify the default value of 1 for this parameter to the boolean value 0.
ENV_PATH: This variable contains the default search path that is applied for all users who do not have UID 0.
ENV_ROOTPATH: This is the same as the previous variable but for root.
FAIL_DELAY: After a login failure, it will take a few seconds before a new login prompt is generated. This variable, which is set to 3 by default, specifies exactly how long it will take.
GID_MAX and GID_MIN: Specifies the minimal and maximal GID used by groupadd (see the "Using Commands for Group Management" section).
LASTLOG_ENAB: If enabled by setting the boolean value 1, this setting specifies that all successful logins must be logged to the file /var/log/lastlog. This works only if the lastlog file also exists.
UID_MAX and UID_MIN: This is the minimum and maximum UID used when adding users with useradd. Use this parameter if you want to change the first UID that is assigned when working with useradd.
Was this article helpful?