You are currently viewing How To Change Password in Linux

How To Change Password in Linux

Linux systems run the world and I am sure you guys know it by now since you are already looking to change passwords. In this guide, we will get into a methods of changing passwords in Linux based systems, covering all the process for the current user, another user and how to force a user to reset password. Please use the following step by step guide to increase security of your linux systems.

1. Changing Current User Password

1.1 Open Terminal:

Launch the terminal on your Linux system. For instance, you can use the terminal emulator in Ubuntu by pressing.

Bash
Ctrl + Alt + T

1.2 Type the passwd Command:

In the terminal, type the following command and press Enter:

Bash
passwd

1.3 Enter Current Password:

You will be prompted to enter your current password. Type it and press Enter.

1.4 Set a New Password:

Upon successful entry of your current password, you’ll be prompted to set a new password. For example:

Bash
Enter new UNIX password:

Type your new password and press Enter. Note that characters will not be displayed for security.

1.5 Confirm New Password:

Confirm your new password by typing it again and pressing Enter.

1.6 Password Changed:

You’ll receive a confirmation message indicating that your password has been changed.

2. Changing Another User’s Password

2.1 Switch to Superuser (Root)

To change another user’s password, you need superuser (root) privileges. Use the following command to switch to the root user:

Bash
sudo su -sudo su -

2.2 Type the passwd Command with Username:

Type the following command, replacing “username” with the target user’s actual username:

Bash
passwd username

2.3 Enter New Password:

Follow the same steps as in Section 1 (steps 1.3 to 1.5) to enter and confirm the new password for the specified user.

2.4 Exit Root Shell:

Once you’ve changed the other user’s password, type exit to exit the root shell.

3. Forcing User to Reset Password

3.1 Open Terminal:

Launch the terminal as explained in Section 1 (step 1.1).

3.2 Force Password Reset:

To force a password reset on the next login, use the following command, replacing “username” with the actual username:

Bash
sudo passwd --expire username

3.3 Confirm Password Reset:

The system will confirm that the password expiration information has been changed. The user will be prompted to reset their password on the next login.

3.4 Logout and Login:

The user must log out and log back in to complete the forced password reset.

Conclusion:

In conclusion, nothing to conclude and you guys can go on to continue with your work, hope this article helps in changing the password of your user and hope you forget it again and come back to this blog to read the article again. And Always exercise caution and make sure that you have the necessary permissions to make these changes, contributing to a robust and secure Linux environment. Stay vigilant and prioritize the security of your system to safeguard against potential threats.

Leave a Reply