We strongly advise RunCloud users to avoid using password authentication for SSH connections, and to use SSH key authentication instead. The root password should only be necessary when you need to execute sudo commands via the command line interface (CLI).
Prerequisites
- Access to your RunCloud panel
- An SSH key pair (if you don’t have one, you’ll need to generate SSH keys)
Step-by-Step Instructions for Resetting root Password
Add SSH Key to Your Server
The first step to reset your root password is to log in to your RunCloud panel and navigate to your server settings.
In the SSH tab, click on the “Add New SSH Key” to add your key to the server.
On the next screen, either select an existing key from the RunCloud vault, or paste a new key (that you created in the prerequisites section) in the provided text box.
For the “User” section, make sure to select the root user.
Once you have made the necessary changes, save the settings to add this key to your server.
Connect to Your Server via SSH
We have already written an in-depth guide that will guide you through the process of connecting your server via SSH. But, if you are in a hurry, you can execute the following command in your terminal to connect to your server as root:
ssh root@your_server_ip
Reset Root Password
Once you have logged in to your server, you can use the passwd command to change the root password.
passwd
Simply execute the above command and you will be asked to enter your new password. Keep in mind that this password will not be displayed on the screen, but all keystrokes will be recorded.
After entering the password, you will be asked to confirm it – simply enter the same password again to confirm your new password.
If you make any mistakes entering it the second time, then the password will not be updated.
If you do make any mistakes, you can simply run the above command again to restart the process.
Make sure to select a strong, unique password to keep your server secure, because as soon as you press “Enter”, your password will be updated.
After changing your password, it is recommended to close the session by executing the following command:
exit
Secure Your Server (Optional but Recommended)
After changing your password, we recommend you disable root login, and enable passwordless login on your servers to keep them secure.
With RunCloud, you can do this in a couple of clicks. Just switch to the Config tab in the SSH settings page and click the checkbox next to each option. Now press “Save Config” to update the configuration on your server.