Linux

Where Is login.defs and What Does It Control?

login.defs at /etc/login.defs sets password aging, UID ranges and mail defaults for useradd and login.

Last updated

login.defs configures the shadow utilities: password aging defaults, UID and GID ranges for new accounts, and mail handling. useradd, usermod and login all read it.

It only affects new accounts and changed passwords, never existing ones retroactively. Pair it with the skel directory when standardizing fresh user setups.

Where Linux stores this, by platform

Linux
/etc/login.defs

PASS_MAX_DAYS, UID_MIN/MAX, CREATE_HOME and friends. Changes apply to future operations only. Validate with a test useradd before fleet wide edits.

Frequently asked questions

how do i change password expiry defaults on linux

Edit PASS_MAX_DAYS and PASS_WARN_AGE in /etc/login.defs. Existing accounts keep their current values until chage updates them individually.

where are uid ranges configured

UID_MIN through UID_MAX plus SYS_UID_MAX in login.defs. useradd picks the next free ID inside those bounds automatically.

Notice an outdated path? Let us know.