我正在尝试使用此命令连接到虚拟机:
sudo ssh -i /home/ritesh/.ssh/id_rsa1 [email protected] -L 5901:localhost:5901
但它给了我这个错误:
The authenticity of host '54.80.22.15 (54.80.22.15)' can't be established.
RSA key fingerprint is X.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'XX.XX.XX.XX' (RSA) to the list of known hosts.
Permission denied (publickey,gssapi-with-mic).
我该如何解决这个错误?
答案1
您需要将您的公钥复制到虚拟机,虚拟机无法识别您的公钥,因此请添加它
$ scp ~/.ssh/id_rsa1.pub [email protected]:.ssh/authorized_keys
或者尝试一下
$ cat ~/.ssh/id_rsa1.pub | ssh tc@[your.ip.address.here] "cat >> ~/.ssh/authorized_keys"