GNU/Linux >> LINUX-Kenntnisse >  >> Linux

SSH-Verbindung zum Google Cloud-Server nach dem Neustart nicht möglich?

Ich habe gelernt, einen Debian-Server zu konfigurieren und mich mit den üblichen Befehlszeilen vertraut zu machen.

Allerdings nach Ausführung des reboot Befehl in SSH, meine nachfolgenden SSH-Verbindungen wurden abgelehnt und ich habe überhaupt keinen Zugriff auf den Server.

Ich konnte ping der Kellner. Ich habe auch versucht, über die Google Cloud-Oberfläche neu zu starten, konnte jedoch immer noch keine Verbindung herstellen.

Da ich dies als Cloud-Server habe, habe ich keinen physischen Zugriff auf den Server. Die Lösung, die ich zu sehen scheine, besteht darin, die SSH-Einstellungen neu zu konfigurieren, was ich ohne Anmeldung nicht kann.

Was sind die möglichen Alternativen, die ich jetzt habe, oder ist die Neuerstellung einer neuen Instanz die einzige Lösung?

Akzeptierte Antwort:

Am besten erstellen Sie den Schlüssel manuell mit der gcloud-Konsole:

[email protected]:~$ 
[email protected]:~$ 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 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
.......
|                 |
|                 |
+----[SHA256]-----+

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>

[email protected]:~$ 
[email protected]:~$ 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:
    http://www.ubuntu.com/business/services/cloud

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
thufir
$ pwd
/home/thufir
$ exit
Connection to <ip address> closed.
[email protected]:~$ 

Quelle:

https://askubuntu.com/questions/803908/

siehe auch:

Wie füge ich einen SSH-Schlüssel mit JSON für Google Cloud Compute VPS an?


Linux
  1. SSH-Anmeldung beim RHEL 7-Server ohne Passwort

  2. Ssh, Sudo, dann herunterladen?

  3. Ssh in einen Server, der mit einem VPN-Dienst verbunden ist?

  4. Stellen Sie über SSH unter Linux oder Mac OS X eine Verbindung zu einem Server her

  5. Verwalten Sie SSH-Schlüsselpaare für Cloud-Server mit python-novaclient

Wie SSH eine sichere Kommunikation herstellt

So fügen Sie dem Server einen öffentlichen SSH-Schlüssel hinzu

12 Dinge, die nach der Installation eines Linux-Servers zu tun sind

Atlantic.Net Cloud – Wie man einen Atlantic.Net Cloud Server weich oder hart neu startet

Wie Sie von Windows aus SSH in Ihren Linux-Server einbinden

Erstellen Sie einen Cloud-Server