Your information hub on all things technology.

How to allow Root login in Google Compute Engine


I recently stumble on Google compute engine looks similar to Amazon AWS and the best part is google is offering free trial for 60 days’ worth $300. So I decided to try google VM instances with serverpilot but root login keeps failing, after a little search I found this tutorial on serverpilot, well it did not work because some things have changed. So am going to show you how to allow root login on your google compute engine VMs.

Am currently using the 7GB ram 2cores plan, which am using to test mariadb on serverpilot with one of the sites I manage. So without wasting much time….

Allow root login on Google compute VMs

1. Create your Instance wait for it to complete, then click on SSH( the will launch a web base terminal)

2. Next you see details of your server or instance, switch to the root user with the following command.

Sudo su root

3. After you switch to root user, you can then change the password, use the following command.

passwd root

This will change your root password so you can use it on putty (Windows) or terminal (Linux/Mac).

4. Now edit this file /etc/ssh/sshd_config with the following command

nano /etc/ssh/sshd_config

5. Change the following in that file, use the arrow directional keys on your keyboard

Change the line;

PermitRootLogin without-password


PermitRootLogin yes

Then change the following line;

PasswordAuthentication no


PasswordAuthentication yes

Then restart the server with the following command;

service ssh restart

Now you can use your google compute VMs on serverpilot or login with root via putty and terminals without any problem.

  1. Christina Lynn says

    Hey Kingsley ,
    An impressive and interesting information, thanks for shared and enjoyed to reading this post.

    1. Kingsley Felix says

      am glad you like it

  2. Amanda Roosey says

    Thanks for sharing an emphatic and remarkable article, I suffered for root login in Google compute engine, finally getting solution and thanks once again!

  3. Mitesh Sanghvi says

    To create and manage virtual machine instances, you can use tools such as Google Cloud Platform Console, the gcloud command-line tool, or the REST API. To perform advanced configuration, connect to the instance using Secure Shell (SSH) or Remote Desktop Protocol (RDP) for Windows instances. Otherwise nice information, thanks for shared.

Leave A Reply

Your email address will not be published.