为什么 Google 计算 VPS 实例需要输入 ssh 密码?

为什么 Google 计算 VPS 实例需要输入 ssh 密码?

为了这已经生成 假的密钥我希望将其添加到下面的实例中。正在挑战什么密码短语以及挑战者是谁?

thufir@mordor:~$ 
thufir@mordor:~$ ssh-keygen -t rsa -b 768 -f ~/.ssh/gcloud -C thufir
Generating public/private rsa key pair.
Created directory '/home/thufir/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/thufir/.ssh/gcloud.
Your public key has been saved in /home/thufir/.ssh/gcloud.pub.
The key fingerprint is:
SHA256:3paYqopihdHBHzW8F9zT+yMaB/JHn6LiMAtvJbW3YPI thufir
The key's randomart image is:
+----[RSA 768]----+
|  .   oo. . .    |
|   o . ..o o .   |
|  . o . . . . .  |
| . . . . + . o   |
|  o     S + o o .|
| . .   + O = = = |
|  .  . oX * B o .|
|.o    oo+E +     |
|+ ....oo...      |
+----[SHA256]-----+
thufir@mordor:~$ 
thufir@mordor:~$ nano .ssh/gcloud.pub 
thufir@mordor:~$ 
thufir@mordor:~$ chmod 400 .ssh/gcloud.pub 
thufir@mordor:~$ 
thufir@mordor:~$ cat .ssh/gcloud.pub 
thufir:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDLehQya4f/rKixCbh2EIB0XvTocDlZnXds+xogHmYW6naXf/9+Uo27rnrnG9P69mQPCR85s9ZC+SfiuEUJ3CVn3XFrCr6wB3TBcjobRYgI62aQgCwyYx0Osc1yJfmxqRU= thufir  google-ssh {"userName":"thufir","expireOn":"2018-12-04T20:12:00+0000"}
thufir@mordor:~$ 
thufir@mordor:~$ ssh-keygen -f .ssh/gcloud -y
Enter passphrase: 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDLehQya4f/rKixCbh2EIB0XvTocDlZnXds+xogHmYW6naXf/9+Uo27rnrnG9P69mQPCR85s9ZC+SfiuEUJ3CVn3XFrCr6wB3TBcjobRYgI62aQgCwyYx0Osc1yJfmxqRU=
thufir@mordor:~$ 
thufir@mordor:~$ gcloud compute instances list
Listed 0 items.
thufir@mordor:~$ 
thufir@mordor:~$ gcloud compute instances create <instance_name>
Created [https://www.googleapis.com/compute/v1/projects/<project>/zones/<zone>/instances/<instance_name>].
NAME  ZONE        MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
<instance_name>   <zone>  n1-standard-1               <internal_ip>   <external_ip>  RUNNING
thufir@mordor:~$ 
thufir@mordor:~$ 
thufir@mordor:~$ gcloud compute instances add-metadata <instance_name> --metadata-from-file ssh-keys=.ssh/gcloud.pub
Updated [https://www.googleapis.com/compute/v1/projects/<project>/zones/<zone>/instances/<instance_name>].
thufir@mordor:~$ 
thufir@mordor:~$ nano .ssh/config 
thufir@mordor:~$ 
thufir@mordor:~$ cat .ssh/config 
Host gcloud
  HostName <external_ip>
  IdentityFile /home/thufir/.ssh/gcloud.pub
  User thufir
thufir@mordor:~$ 
thufir@mordor:~$ ll .ssh
total 80
drwx------  2 thufir thufir  4096 Jul 29 02:42 ./
drwx------ 71 thufir thufir 36864 Jul 29 02:33 ../
-rw-rw-r--  1 thufir thufir    96 Jul 29 02:42 config
-rw-------  1 thufir thufir   791 Jul 29 02:33 gcloud
-r--------  1 thufir thufir   255 Jul 29 02:34 gcloud.pub
thufir@mordor:~$ 
thufir@mordor:~$ ssh gcloud
The authenticity of host '<external_ip> (<external_ip>)' can't be established.
ECDSA key fingerprint is SHA256:ek2g0GTj6Dxtb4vvwTNXRJgRKXnaLjoWZRv1lZ4pJ30.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<external_ip>' (ECDSA) to the list of known hosts.
Enter passphrase for key '/home/thufir/.ssh/gcloud.pub': 
Enter passphrase for key '/home/thufir/.ssh/gcloud.pub': 
Enter passphrase for key '/home/thufir/.ssh/gcloud.pub': 
Permission denied (publickey).
thufir@mordor:~$ 
thufir@mordor:~$ ssh-keygen -f .ssh/gcloud -y
Enter passphrase: 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDLehQya4f/rKixCbh2EIB0XvTocDlZnXds+xogHmYW6naXf/9+Uo27rnrnG9P69mQPCR85s9ZC+SfiuEUJ3CVn3XFrCr6wB3TBcjobRYgI62aQgCwyYx0Osc1yJfmxqRU=
thufir@mordor:~$ 
thufir@mordor:~$ 

据我所知,我手动输入的密码是正确的。但是,当连接到 Google 云计算机 VPS 实例时,系统要求我输入密码。

答案1

这:

IdentityFile /home/thufir/.ssh/gcloud.pub

应该

IdentityFile /home/thufir/.ssh/gcloud

ssh要求输入垃圾数据的密码

相关内容