For an existing instance

This tutorial can be applied for any operating system available from our control panel. To setup root logins for your Instance, start by logging in to it. You can login with an SSH connection, or through the console from your Instance’s management page.

 

Set a password

First, you need to setup a password for the root account on your Instance, input the following command:

sudo passwd root

NOTE: You might be prompted for the current user’s password, input the same password that you logged in to the Instance with.

 

Configure the ssh service

After setting a password for the root account, you need to permit root logins with SSH connections. You can do this by modifying the SSH config file located in /etc/ssh/sshd_config. Modify the file with the following command:

sudo sed -i "s/.*PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config

 

Restart the ssh service

Finally, you need to restart the SSH service. Depending on your operating system, this command is different.

For Ubuntu / Debian:

sudo service ssh restart

For CentOS / Fedora:

sudo service sshd restart

After the SSH service has restarted, you can login to your Instance with the password you setup earlier.

 

Snapshotting for future instances

If you wish to snapshot your instance so that you do not need to repeat the process in the future, we recommend running the following commands to ensure that none of your changes are accidentally cached:

sysctl -w vm.drop_caches=3
sync

After running these commands, take a snapshot of your Instance using the snapshot function on control panel.

 

Note about SSH password authentication

In some versions of Linux, password authentication using SSH connections gets disabled by default, in this case, you can use our instance creation form to allow it.

When building a new Instance from a snapshot, please select the value Yes under Additional settings->Allow password authentication for ssh.