How to Change the Root Password on a Linux VPS Print

  • 0

How to Change the Root Password on a Linux VPS

Changing the root password is an important security task when managing a Linux Cloud VPS. If you received an initial or temporary root password when your VPS was activated, you should replace it with a strong and unique password.

ApnCloud Cloud VPS Hosting is an unmanaged service, so customers are responsible for managing their own operating system, passwords, software, security, backups, and server configuration.

1. Connect to Your VPS Using SSH

First, connect to your Linux VPS using SSH.

Open Windows Terminal, PowerShell, Terminal, or another SSH client and enter:

 
ssh root@YOUR_SERVER_IP
 

Replace YOUR_SERVER_IP with your actual VPS IP address.

If your VPS uses a different administrative username, use that username instead.

2. Log In with Your Current Password

If password authentication is enabled, enter your current root password when prompted.

While entering the password, the terminal may not display any characters. This is normal.

Press Enter after typing the password.

3. Run the Password Command

After logging in as root, enter:

 
passwd
 

Press Enter.

The system will ask you to enter a new password.

4. Enter Your New Root Password

Enter your new password when prompted.

Use a strong and unique password containing a combination of:

  • Uppercase letters
  • Lowercase letters
  • Numbers
  • Special characters

Avoid using easy-to-guess information such as your domain name, company name, phone number, birthday, or common passwords.

5. Confirm the New Password

The server will ask you to type the new password again.

Enter the same password and press Enter.

If both passwords match, you should see a confirmation message indicating that the password was updated successfully.

6. Test the New Password

Before ending your current SSH session, it is a good idea to open a second terminal window and test the new password.

Connect again using:

 
ssh root@YOUR_SERVER_IP
 

Enter the new password when prompted.

If the login works correctly, the password change has been successful.

7. Store Your Password Securely

Keep your root password in a secure location.

Do not:

  • Share the password through public messages
  • Store it in an unsecured text file
  • Reuse the same password on multiple servers
  • Send the password in a support ticket

Using a trusted password manager can help you store strong and unique passwords securely.

If You Are Logged In as Another User

If your Linux VPS uses a sudo-enabled administrative user instead of direct root login, you may need to use:

 
sudo passwd root
 

The available method depends on your operating system and server configuration.

Forgot Your Root Password?

If you have lost access to your root account, check whether your VPS management panel provides a password reset, recovery, rescue, or console option.

The exact recovery options depend on the virtualization platform and server configuration.

If you cannot access your VPS, contact ApnCloud Support for service-level assistance.

Password Change Failed?

If the passwd command fails, check:

  • You have administrative privileges
  • The operating system is functioning normally
  • The filesystem is not read-only
  • There is sufficient disk space
  • Your VPS is not experiencing a system-level issue

If you are unsure about the cause, review the error message before making additional system changes.

Additional Security Recommendations

Changing the root password is only one part of VPS security.

You should also consider:

  • Keeping the operating system updated
  • Using strong passwords
  • Using SSH keys where appropriate
  • Configuring firewall rules
  • Removing unnecessary software and services
  • Monitoring login activity
  • Maintaining regular backups

Important: Unmanaged VPS Responsibility

ApnCloud Cloud VPS Hosting is provided as an unmanaged VPS service.

Customers are responsible for operating system administration, password management, software configuration, security, updates, backups, and application management.

Need Help?

If you cannot access your VPS or experience an ApnCloud service-level issue, open a Support Ticket from your ApnCloud Client Area.

Include your VPS IP address and the error you are receiving, but never include your root password or private SSH key in the ticket.


Was this answer helpful?

Related Articles

« Back