0

I'm having troubles connecting to an instance on Compute Engine via SSH. If I try via command line I get the following error:

Permission denied (publickey)

The same happens if I connect via browser interactive console. In the serial port output I see:

Mar 22 14:17:04 metadata sshd[9260]: Invalid user name_lastname from xx.xx.xx.xx
Mar 22 14:17:04 metadata sshd[9260]: input_userauth_request: invalid user name_lastname [preauth]

The strange fact is that some minutes ago I didn't have any problem connecting to it and it started occurring after I have resized the instance (changed machine type from small to n1-standard-2).

The boot disk is not full and I haven't modified any user.

I've also tried to add the firewall rule but it doesn't work. I have several other machines on the same project and I can connect to them properly.

I can connect to the interactive serial console using another user previously created on the machine (manually), but I cannot become root from that.

Thanks a lot.

1 Answer 1

1

That is a SSH key authentication issue. Check out this answer on stackoverflow for some useful information.

In order to interact with instance's serial console to troubleshoot a VM, you will need to have root or a sudoer privilege. You can add the following startup script to your VM and then reboot it to create a sudoer account:

useradd -G sudo USERNAME
echo 'USERNAME:PASSWORD' | chpasswd

Replace USERNAME and PASSWORD with values that you wish.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .