Manage password expiry on Linux

tux_compUsers tend not to change their passwords often due to the apparent inconvenience caused. However, in a multi-user environment, it is preferred that users change their passwords regularly. This also applies if the admin wants users to change their password on their very first login, i.e., immediately after their account details are handed over to them.

To setup a password expiry policy, e.g., to force password expiry every 15 days, run:

$ sudo passwd -n 15 username

To check how many days left to password expiry:

$ sudo chage -l username
Last password change					: Oct 01, 2015
Password expires					: never
Password inactive					: never
Account expires						: never
Minimum number of days between password change		: 15
Maximum number of days between password change		: 99999
Number of days of warning before password expires	: 7

To allow the user change his password any time (default behaviour), i.e., no enforcement, run:

$ sudo passwd -n 0 username

To force a password resent on next login, run:

$ sudo chage -d0 username
// OR
$ sudo passwd -e username

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s