GNU/Linux >> Linux の 問題 >  >> Linux

再起動後にGoogleCloudServerにSSHで接続できませんか?

私はDebianサーバーの構成を学び、一般的なコマンドラインに慣れていました。

ただし、rebootを実行した後 SSHでコマンドを実行すると、後続のSSH接続が拒否され、サーバーにまったくアクセスできなくなりました。

pingできました サーバー。 Googleクラウドインターフェースからも再起動しようとしましたが、それでも正常に接続できませんでした。

これをクラウドサーバーとして使用しているため、サーバーに物理的にアクセスすることはできません。私が見ている解決策は、ログインしないとできないSSH設定を再構成することです。

私が現在持っている、または新しいインスタンスを再作成することが唯一の解決策である可能性のある代替案は何ですか?

承認された回答:

最善の策は、gcloudconsoleを使用して手動でキーを作成することです。

[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]:~$ 

出典:

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

参照:

GoogleクラウドコンピューティングVPS用にJSONでSSHキーを追加するにはどうすればよいですか?


Linux
  1. Ssh、Sudo、それからダウンロード?

  2. LinuxまたはMacOSXでSSHを使用してサーバーに接続します

  3. python-novaclientを使用してクラウドサーバーのSSHキーペアを管理する

  1. サーバーを再起動します

  2. Active Directory (AD) ドメインに統合した後、サーバーに ssh できない [CentOS/RHEL 7]

  3. ~/.ssh/id_rsa.pub をコピーできません

  1. パスワードなしでRHEL7サーバーにSSHログイン

  2. Ssh – Sshサーバーにログインするためのシェルスクリプト?

  3. VPNサービスに接続されているサーバーにSSHで接続しますか?