MilesWeb
UK Web Hosting Company
Award-winning Web Hosting Company
Everything that you need to build, host and manage a website is available at just 0.60/mo

Discover the Steps to Change a Password in Linux

Passwords help to secure any system along with Linux. You may find Passwordless SSH as a trustworthy alternative, but at last a strong password is a great option to secure your system. A strong password only makes our system highly reliable. This tutorial will guide you on changing a password in Linux.

You will also get to learn how to change it for other users on your VPS.

Passwords in Linux

Linux is globally considered to be one of the safest systems due to the way processes are handled. But, each of the operating system depends on the use of passwords at some point. Passwords are managed by Linux in a very similar way to other systems. However, you should know two important directories in password management.

The first file is /etc/passwd where you will find all users on the system. Additionally, it displays which group of the system they are a part of. You might see many users, but only few will be able to log in as they are system users.

For viewing the content of /etc/passwd, run the below command:

The second Linux file is /etc/shadow that is strongly related to passwords. In this file, you will be able to see the users’ encrypted passwords and also know if they have an SSH key.

Finally, it is recommended that you should have strong passwords so that it becomes difficult to guess them, or brute-force them. But, in case you find that your password has been compromised, you can change it. Experts advice this to do frequently!

Command to Change a Password Linux

There is just one command required to change the unix password. Even if you are the regular user, first access your VPS through SSH. Then to change the password in Linux, open the terminal and type the following command:

After running the command, you will be asked to enter the new password twice. Here, you will be change the root password without specifying the user.

Commands to Change a Password in Linux for Another User

You can change the password for another user in the same system. For this, make sure you are logged in as a root user and add the user’s name to the passwd command. You will be prompted by the same request to enter the new password twice. The command would look as below in the command line:

In this case you are changing the password of the user named john.

It’s so simple! You have successfully updated the password.

Conclusion

It is important to change a password in Linux for the security of your project. The process is very simple, and so we recommend you to change the password frequently for maximum security.

Pallavi Godse

Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.

Leave a Reply

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