다음을 위해가짜열쇠, 와Google 컴퓨팅 클라우드 프로젝트에 SSH 키 추가:
thufir@mordor:~$ ssh-keygen -t rsa -b 768 -f ~/.ssh/gcloud -C thufir
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/gcloud.
Your public key has been saved in /home/thufir/.ssh/gcloud.pub.
The key fingerprint is:
SHA256:pS6ohohbMBD4cQi+s19JyhCuYT+GeSx+uvhzcqnMb2s thufir
The key's randomart image is:
+----[RSA 768]----+
|+. . |
|o.o . |
|.+ o . |
|o + o |
|+* . S |
|o+X o... |
|+*.O.+. . |
|*+OoE . |
|oBX@o. |
+----[SHA256]-----+
thufir@mordor:~$
thufir@mordor:~$ nano .ssh/gcloud.pub
thufir@mordor:~$ cat .ssh/gcloud.pub
thufir:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQCy904Zqx4BvR+bXEH5wgdbO2B6pKem9ZV7yzouTP2XawO7y9xfGmKnxPoUrDbdc5l/MLSkOiXZd9o3UYwD3I+XfuSTg/1+S/QC5CACQxymiJWav3w+zCBVO5rSnr4IkOM= thufir google-ssh {"userName":"thufir","expireOn":"2018-12-04T20:12:00+0000"}
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/<instance>/zones/<zone>/instances/<instance_name>].
thufir@mordor:~$
thufir@mordor:~$ ssh gcloud
The authenticity of host '<ip_address> (<ip_address>)' can't be established.
ECDSA key fingerprint is SHA256:0s0rx7SXvhpJHj1owMgPVBpNUojx8vZ5kR9erw3AujA.
Are you sure you want to continue connecting (yes/no)? ^C
thufir@mordor:~$
thufir@mordor:~$ rm .ssh/
config gcloud gcloud.pub
thufir@mordor:~$ rm .ssh/
config gcloud gcloud.pub
thufir@mordor:~$
thufir@mordor:~$
thufir@mordor:~$ ssh -v gcloud
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /home/thufir/.ssh/config
debug1: /home/thufir/.ssh/config line 1: Applying options for gcloud
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <ip_address> [<ip_address>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/thufir/.ssh/google_compute_engine.pub type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/thufir/.ssh/google_compute_engine.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u2
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <ip_address>:22 as 'thufir@mordor'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:0s0rx7SXvhpJHj1owMgPVBpNUojx8vZ5kR9erw3AujA
The authenticity of host '<ip_address> (<ip_address>)' can't be established.
ECDSA key fingerprint is SHA256:0s0rx7SXvhpJHj1owMgPVBpNUojx8vZ5kR9erw3AujA.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<ip_address>' (ECDSA) to the list of known hosts.
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/thufir/.ssh/google_compute_engine.pub
no such identity: /home/thufir/.ssh/google_compute_engine.pub: No such file or directory
debug1: No more authentication methods to try.
Permission denied (publickey).
키 형식이 잘못되었나요? 제가 잘못 올렸나요? = thufir
나중에 변경 사항을 삭제 key_value
하거나 삭제 thufir
하고 유지해 보았습니다 =
. ssh 명령을 통해 생성된 키를 추가하는 방법에 대한 지침을 잘못 읽었나 봅니다. 왜냐하면 다음 지침이 다음과 같기 때문입니다.
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILE_NAME] -C [USERNAME]
후행하는 키가 있어서 방향과 맞지 않는 키가 생성된 것 같습니다 = thufir
. 제거해야 할까요?
그것은 단지 더미 키였고 나는 gcloud
그것을 삭제했습니다 gcloud.pub
.