Anyone who has a user account should change their password periodically. The time interval between two password changes can be set by the System Administrator. And, it is the responsibility of the System Administrator to inform users about when their password is about to expire. This makes a user take timely action. So, in this article, we cover how to warn the user about password change in Ubuntu.
This can achieved through two command-line utilities -
- chage and,
By default the number of warning days the set to 7.
Note: Following operations require superuser privileges. In case you don't understand what you're try to achieve then, contact your System Administrator for assistance.
Warn the user about password change in Ubuntu
I. We start with chage first. Use the following syntax -
sudo chage -W <warn_days> <username>
So, let's say we have user abc and we want the number of warning days to be 5. Then,
sudo chage -5 abc
II. This can also be done using passwd command-line utility -
sudo passwd -w <warn_days> <username>
Again, for user abc - we can set the number of warning days back to 7 -
sudo passwd -w 7 abc
Now, at this stage you must be wondering how to view the changes we have made. We can view number of warn days related information through chage command-line utility itself -
sudo chage -l <username>
where, -l is used to view account aging information.
In conclusion, we have covered how to warn the user about password change in Ubuntu. In next article, we cover how to make a user periodically change passwords i.e. password change is required once a set number of days have passed.