How to Allow Root Login in Google Compute Engine

Google compute engine
  • Save

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.

- Advertisement -

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;

- Advertisement -
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.

Google compute engine
  • Save
Kingsley Felix
Based in Port Harcourt, Nigeria. I am the founder of Krafty Sprouts Media, LLC (US), i make sure thing run smoothly and well organized in our organization.Follow me on my social media platforms.
Share via
Copy link