Knowledge Base
MilesWeb / VPS FAQ

Discover the Steps to Change a Password in Linux

Approx. read time : 2 min

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:

cat /etc/passwd

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.

cat /etc/shadow

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:

sudo passwd

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:

passwd user_name

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

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

Trusted By Thousands of Clients & Big Businesses

We highly appreciate the kind and stellar feedback we receive from our customers. Delivering the best is our goal! MilesWeb is rated Excellent out of 5 based on reviews. Read more reviews.

Excellent
Based on reviews
2 hours ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
4 hours ago
Milesweb is superb Hosting pro...
Milesweb is superb Hosting provider ever, their Support team is amazing!!!...
Abhishek Singh
15 hours ago
Great support in great timing...
We need urgent assistance on changes in a primary domain on our client's Cpanel accounts and reached...
Riyaju Deen
21 hours ago
Best Website Hosting platform ...
I was new on MilesWeb. And needed help on multiple areas from setting up to getting started with cre...
Harshada
1 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
1 days ago
the team is very supportive th...
the team is very supportive though at times effort needs to be made to make understand the problem s...
Suree Sharma
1 days ago
I am using miles web for 3plus...
I am using miles web for 3plus years, very quick and perfect support by the team, they helped me man...
Sri Raghav
2 days ago
The service is good...
The service is good. They are answering with patience and doing the needful as soon as possible....
MR
2 days ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
3 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
4 days ago
positively helped me with find...
positively helped me with finding insecure content on my website causing SSL to not work properly on...
Thaviraj Junglee
4 days ago
Exceptional support, Truly Pra...
I had opted for the basic wordpress hosting plan as I intended to experiment with various plug-ins. ...
Aseem Chandna