How to Allow Root Login in Google Compute Engine

Google compute engine

I recently stumble on Google compute engine looks similar to Amazon AWS and the best part is Google is offering a free trial for 60 days worth $300.

So I decided to try google VM instances with serverpilot but the 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 i 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

To

PermitRootLogin yes

Then change the following line;

PasswordAuthentication no

To

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 Shares:
1 comment
  1. 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. Required fields are marked *

You May Also Like