猿问

无业游民:权限被拒绝(公钥)

我得到许可被拒绝(公钥)做SSH时错误SSH用户名@ IP而SSH当我们正在做的工作漂泊不定的ssh


VagrantFile:


Vagrant.configure("2") do |config|

 config.vm.box = "ubuntu/xenial64"

 config.vm.network "forwarded_port", guest: 80, host: 8071

 config.vm.network "private_network", ip: "192.168.33.71"

end

我正在终端上尝试ssh ubuntu@192.168.33.71


出现错误:权限被拒绝(公钥)


MMMHUHU
浏览 306回答 3
3回答

慕无忌1623718

您可以检查此问题以解决问题。I think that config.vm.synced_folder '.', '/home/vagrant/' caused this problem.Because the configure makes home directory on the host overwritten and destroy .ssh settings on the host.I got the same problem a few seconds ago. I checked the .ssh was overwritten by Vagrant GUI.

慕斯709654

在与流浪者盒子的连接中使用私钥ssh -i .vagrant/machines/default/virtualbox/private_key vagrant@192.168.33.71

PIPIONE

我猜如果您vagrant ssh按照@Anurag的说明进行尝试,则可以连接。要修复该Permission denied (publickey)错误,以便您可以从主机中的任何位置ssh到该框,可以创建一个ssh密钥,然后将公共密钥复制到guest虚拟机上的authorised_keys文件中。&nbsp;ssh-keygen您可以选择其他文件来保存密钥。然后使用添加身份ssh-add <path to your key>。
随时随地看视频慕课网APP
我要回答