Root SSH Access on Virtual Machines

Introduction

Our cloud platform offers virtual machines (VMs) with a default superuser account. This superuser account, however, is not the root user. For enhanced control and administrative purposes, you might require root access. This document guides you through the steps to enable root access on your VM.

Initial Login

  • Username/Password: Upon creating a VM, you receive a superuser account that is not the root account. The credentials are visible in the VM panel > access tab.
  • Mandatory Password Change: At your first login, you will be prompted to change your password for security reasons.

Enabling Root Access

Follow these steps to enable and secure root access:

  1. Logging in as Superuser: First, the user needs to log in to the virtual machine using the superuser credentials provided.
  2. Setting the Root Password: Once logged in as a superuser, the user can set or change the root password by running the following command:
sudo passwd root

This command will prompt the user to enter and confirm a new password for the root account.

Enabling SSH Access for Root User

If SSH access for the root user is disabled by default, it can be enabled with these steps:

Edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Find the line #PermitRootLogin prohibit-password or #PermitRootLogin no (If there is # in the beginning of the line remove it). Then change the line to the following, without any # in the begining. :

PermitRootLogin yes

Save the file and exit the editor. (Press ctrl+x and then press y and then hit ENTER). This way you will allow the root user to login. For more information about this setting, check out this link.

Now restart the SSH service to apply the changes using this command:

sudo systemctl restart sshd

These steps will grant root access to the user. It’s important to remind users about the security implications of enabling root access and to follow best practices for securing their virtual machines.

Please do tell us, did you find the content above helpful?