Linux Change Password

How to Change Linux VPS Password?

In this article, we are going to learn how to Change the Linux OS password and also how you can change the password if you have forgotten them. Before we get to our main discussion on how to Change the Linux OS password, let’s see how we can create a strong and safe password. After buying Linux VPS, it makes sense to know how to change its password. In the end, you will know the way you can change your chosen distribution password with some easy steps.

How to Create a Strong & Safe Password?

For many people, the challenge of creating passwords that are both secure and unique can seem like a daunting one. Generating and remembering a slew of different passwords, like Wt4e-79P-B13qS, is a recipe for disaster.

So, while knowing that a single password can disclose all of your online information if it is hacked, you may still be using the same password across many sites. On the other hand, if all of your passwords are made up of short, basic words or numbers that have some connection to your personal life, this is still a security risk. The length (the larger, the better), a combination of letters (upper and lower cases), digits, and symbols are the most crucial parts of a secure password. No links to your private details, and of course no dictionary phrases.

Tips for Creating a Password that’s a One-of-a-Kind:

  • Incorporate a phrase and shorthand codes or acronyms into your writing.
  • Keep your passwords simple, but remember to change them for each site you visit.
  • Avoid using numbers or letters that follow one other.

When it comes to passwords, it can be difficult to develop one that is both strong and secure. Fortunately, you can use, which is considered safe to use and allows you to select what kinds of elements you want to include in your password by checking boxes on the left side of the page. For example, you can choose the length, including numbers, symbols, Lowercase and Uppercase characters, Similar or Ambiguous characters, and other options. Click the Generate Password button after you’ve checked the boxes you want to use and receive your generated safe and secure password. Now let’s see how to Change the Linux OS password.

Change Linux OS password by following this step-by-step guide

The login information for your Linux VPS (Virtual Private Server) is sent to you once you’ve ordered it from the service provider. Once you obtain your VPS, resetting the password is a good idea!

For security concerns, this is the case here. Firstly, it is likely that your VPS service provider already has your password. Secondly, you will receive your VPS password in plain text through email. To access your VPS, you’ll need the password that was sent to this email address. It is time to begin!

Note that Centos 6.9 was used to develop this guide. However, the steps of how to Change Linux OS password are similar in other Linux distributions.

Things you need before starting:

  • The IP address of your VPS
  • Password and username

How to change Linux password [CentOS, Debian, Ubuntu, FreeBSD]

Open Putty and enter your virtual private server’s Hostname or IP address. Other fields can be left alone to default.

Change password Linux VPS with Putty

Log in with your username and password.

putty change password

Login as: this is where you’ll enter your username to access the website.

root@*You VPS IP* password: Type your VPS password in this section.

Note that it will not show any characters when you input the password. This is done for your own safety. Please enter the password by typing it in and pressing enter.

Type “passwd” and hit enter

The new password can now be entered. It won’t be shown (this is a security measure).

Congratulations! On your Linux VPS, you’ve successfully updated your password.

Change Linux User Password (Another Method)

The first thing you need to do is to access your VPS by using SSH.

In Linux, you can update your password using the command:


Unless you’re logged in as a root user, you’ll need to enter your current user password. You’ll be asked to enter the new password twice in the command line. It’s going to be like below:

Enter new UNIX password:
Retype new UNIX password:

The result should look like this when you’ve successfully changed your password.

passwd: password updated successfully

If you see this message, it implies your new password has been set. You’ll need this password the next time you check-in.

Changing Passwords for Other Users

Another user account on the system can change its password using the passwd command. Log in as root and use the passwd command with the user’s name as the argument.

passwd [username]

This is how you would run the command to update the password for a user named Granit.

passwd Granit

After that, the terminal will ask you to enter your new password a second time via the command line.

Enter new UNIX password:
Retype new UNIX password:

The following output will be shown to you if you use the passwd command to change the password for the other user.

passwd: password updated successfully

How to Change User Password Without having the previous passwords

As a regular user, you may lose your password, and for choosing a new one, you need to rest the password.

As a root or sudo user, you can use the passwd [username] command to easily change the password for the user you’re logged in as.

For non-root users, the sudo passwd command must be used instead of sudo. As the last step, they’ll be tasked with entering their passwords.

When LDAP authentication is used, the command may require a user’s forgotten password.

Let’s say you’d like to update the password for a user by the name of Granit. When you type the sudo passwd Granit command on the terminal, you’ll have to provide the user password for Granit.

Using the /etc/shadow file, you can duplicate the encrypted password of another user. Use this command to open the file using the Nano text editor:

nano /etc/shadow

Make a note of the user whose password you’d like to modify. The encoded password is the sequence of characters after the user name, between the two colons (:)

Obtain another user whose password you have. So if you know the password for user Leon, you may use that as a temporary password for Granit, as seen in the example below: This new password should be used in place of Granit’s old one.

Now that the user Granit has the same password as user Leon, just use the passwd command to create a new one:

sudo passwd granit

A new password for Granit will be requested once you have entered the temporary one.

Having a special password entails using it just once, per user account. For instance, the user password for your bank account should not be the same as your VPS password. It just takes one compromised account for unauthorized users to get into other accounts if you use the same user password across many accounts. You run a larger chance of losing confidential information and experiencing financial losses as a result.

To change your VPS password, you will need to provide:

  • The IP address of your VPS
  • Username and password

While password complexity is vital, its length will always be more important.


Protecting your VPS and enhancing its security is dependent on the use of passwords. Change your Linux password on a regular basis to strengthen your security and reduce the possibility of illegal access.

To update your Linux password, all you have to do is run a simple command and enter your new password. In addition, any Linux distribution can use similar techniques.

By setting a maximum password validity period for numerous users, you can urge them to update their passwords more frequently.

Let us know what more you’d like to learn in the comments section below.

Leave a Reply

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