I was learning to configure a Debian server and familiarising myself with the common command lines.

However, after executing the reboot command in SSH, my subsequent SSH connections were refused and I have total no access to the server.

I was able to ping the server. I attempted to reboot through the Google cloud interface too, however I was still unable to connect successfully.

Having this as a cloud server, I do not have any physical access to the server. The solution that I seem to see are to reconfigure the SSH settings which I can't without logging in.

What are the possible alternatives I have now or recreating a new instance is the only solution?

  • be prepared for the fact that you might have to redo your server from scratch....baring any help that the google cloud server people may be able to provide you. – mdpc May 9 '14 at 1:08
  • @mdpc thanks for your reply. i am pretty much ready to redo the server. but my main concern is how can i avoid such problems in the future although reboot doesn't occur often but may be still required at times. – toffee.beanns May 9 '14 at 1:23
  • It's a bug. It also happened to me. You have append JSON to the key. – Thufir Jul 28 '16 at 11:12
  • Did the IP address of the server remain the same? – multithr3at3d Dec 31 '17 at 20:15

Your best bet is to create the key manually with the gcloud console:

thufir@mordor:~$ gcloud compute config-ssh
WARNING: The private SSH key file for Google Compute Engine does not exist.
WARNING: You do not have an SSH key for Google Compute Engine.
WARNING: [/usr/bin/ssh-keygen] will be executed to generate a key.
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/thufir/.ssh/google_compute_engine.
Your public key has been saved in /home/thufir/.ssh/google_compute_engine.pub.
The key fingerprint is:
SHA256:ioreurewiopruweoiprwe thufir@mordor
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |

Updated [https://www.googleapis.com/compute/v1/projects/<project>].
You should now be able to use ssh/scp with your instances.
For example, try running:

  $ ssh <instance>.<location>.<project>

thufir@mordor:~$ ssh <instance>.<location>.<project>
The authenticity of host 'compute.<####> (<ip address>)' can't be established.
ECDSA key fingerprint is SHA256:<fingerprint?>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'compute.<####>' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-31-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:

0 packages can be updated.
0 updates are security updates.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

$ whoami
$ pwd
$ exit
Connection to <ip address> closed.



see also:

How do I append a SSH key with JSON for Google cloud compute VPS?

| improve this answer | |

I think Google gives a quite a comprehensive list of solutions for troubleshooting SSH errors, please refer here.

IMO, you may have incorrectly set up SSH keys, or there are misconfigured iptables.

| improve this answer | |
  • hey delta24, thanks for your answer. I am still testing out the server, but seems like i got stucked at one part of the solution list you provided. I ran the command to add the ssh rule to the firewall and tried to do a netcat test to see the banner. However, nothing came out. There was no further instructions to which I could try out. Could you help me out? Appreciated! – toffee.beanns May 9 '14 at 13:48
  • google seems to do very strange things with SSH keys and JSON. – Thufir Jul 28 '16 at 11:19

Good night, this has just happened cmg tbm, I think you should have already fixed or reconfigured your vps, but for those who face this problem, I was able to connect through port 443, after that, run nano command / etc / ssh / sshd_config and uncomment the line that has #Port 22, only take the #

enter image description here

| improve this answer | |
  1. On GCP, view your instance then edit it.
  2. Under "Remote access" enable connecting to serial ports.
  3. Scroll to the bottom of the page and click "Save".
  4. View your instance again and this time under "Remote access" you'll have the option to "Connect to serial console". This allows you to access your instance's command prompt even when your SSH is failing (usually due to wrong configuration of /etc/network/interfaces file).
  5. Connecting to the serial console requires you to login to an existing account. So do remember to set your passwords using passwd before you mess around with the networking.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.