Like Windows systems, Linux and Ubuntu users can be forced to change their password at next logon. This allows a user to logon with current password and immediately be prompted to change it.
One thing to remember is when creating a new user via Ubuntu desktop (GUI), you can choose the option to allow the user to create their password at next logon. at the time of creation.
If the account is already exists you won’t be able to use the GUI to prompt the user to immediately change his/her password. To allow that to happen, you will have to expire the user account of use the passwd command.
The steps below show you how to force Ubuntu users to immediately change their passwords at next logon
When you’re ready to force user to change their password, follow the steps below:
Step 1: For New Users to Change Password
When you’re setting up a new user, you can for the user to create a new password at the next logon. this option only available at the time or creating. after the account is created, you won’t be able to use it.
At create a new user and force the user to change his/her password at the next logon, go to System Settings from Ubuntu menu and navigate to Details ==> Users ==> Unlock button at top right corner. than Add User.
On the user creating screen, choose to have the user create a new user at the next logon as shown in the image below:
This setting should allow the user change password at the next login.
Step 2: Force Existing Users to Change Password
For existing users, you’ll have to force them to change their password at the next login. to do that, run the commands below to expire the user account password.
Expired account passwords are automatically prompted to change password.
sudo passwd --expire richard
Replace richard with the user account on the system. the next time the user tries to sign on, he/she will be prompted to change the current password. the user must know the password that was expired to be allow to change it.
You can also use the chage command with the -d or –lastday option which sets the number of days since January 1st, 1970 when the password was last changed.
When you set it to 0, the account is automatically expired and will prompt to change at the next login.
sudo charge --lastday 0 richard
That should also force the user to change his/her password.
That’s it! This is how to for user to change their password at the next login
You may also like the post below: