Force Ubuntu Users to Change Password at Next Logon

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..

ubuntu dash dock

On the user creating screen, choose to have the user create a new user at the next logon as shown in the image below:

ubuntu user change password

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.

ubuntu user passwor change

That’s it! This is how to for user to change their password at the next login

Enjoy!

You may also like the post below:

Installing Apache2, MariaDB on Ubuntu 16.04 / 17.10 / 18.04 with PHP 7.2 Support (LAMP)

 

3 Replies to “Force Ubuntu Users to Change Password at Next Logon

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.