How to Change Linux Password

In using the Linux operating system, we need good security, apart from Linux itself which has a strong security system compared to other operating systems, such as Windows, Mac OS, and others.  


Passwords are the protection of any system including Linux. SSH without a password can be another option, but in the end, you still need a strong password as the best option. Having a strong password makes your system more secure. In this tutorial, we will share tips for changing Linux passwords on various distributions such as Ubuntu, Debian and CentOS.


How to Change Linux Password


To change the Linux password, you only need to know one command. First, access your VPS via SSH. Then, to change the Linux password, you need to open a terminal and type the command:


sudo passwd

After running the command, you will be prompted to enter the new password twice. In this step, when we don't specify the user, we will change the root password. The output looks like the following:


Enter new UNIX password: 
Retype new UNIX password:

If you successfully change the password, the command line will show output like this:


passwd: password updated successfully

That means your old password has been replaced with a new one.


Linux Password


Linux is also known as one of the most secure systems in the world because of the way it handles processes. However, every operating system relies on passwords for its security. For this reason, we recommend that you get to know two important directories in Linux password management.


The first file is /etc/passwd where you can find all the user passwords in the system. Additionally, this file shows the password ownership of each group in the system. You can see many users, but only a few can log in because they are system users.


If you want to view the contents of /etc/passwd, you can do so with the command:


cat /etc/passwd

The second Linux file that is closely related to passwords is the /etc/shadow file. In the shadow file, you can find out encrypted user passwords and find out if each user has an SSH key and other related information.


cat /etc/shadow


Conclusion 


So to change passwords on Linux is important for the security of your project. we recommend that you change passwords frequently for maximum security.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.