How to change the root password on a Linux server?
Note:
This guide applies to both HostZealot VPS and Linux Dedicated Servers.
You can change the root password of your Linux server directly from the command line using the passwd command.
Before you begin, make sure you have your server IP address, current root password, and SSH port. You can find the connection details in the Welcome Email sent after your server was activated.
Connect to Your Server via SSH
Open an SSH client. You can use Terminal on macOS or Linux, Windows Terminal or PowerShell on Windows.
Connect to your server using the following command:
ssh root@your_server_ip -p your_ssh_port
Replace your_server_ip with your server's IP address and your_ssh_port with the SSH port provided in your Welcome Email.
When prompted, enter your current root password.
root@your_server_ip's password:
After successful authentication, you will be logged in to your server as root.
Change the Root Password
Run the following command:
passwd
Enter your new password when prompted, then enter it again to confirm:
New password:
Retype new password:
passwd: password updated successfully
Your root password has now been changed. Use the new password the next time you connect to the server.
Note:
Depending on your Linux distribution and password policy, you may see a warning if the new password is considered weak. Use a strong, unique password for your server.
What if you forgot the root password?
If you no longer have access to the current root password and cannot log in to your server, contact HostZealot Support for assistance.