我得到許可被拒絕(公鑰)做SSH時錯誤SSH用戶名@ IP而SSH當我們正在做的工作漂泊不定的sshVagrantFile: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 [email protected]出現錯誤:權限被拒絕(公鑰)
3 回答

慕無忌1623718
TA貢獻1744條經驗 獲得超4個贊
您可以檢查此問題以解決問題。
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
TA貢獻1840條經驗 獲得超5個贊

PIPIONE
TA貢獻1829條經驗 獲得超9個贊
我猜如果您vagrant ssh
按照@Anurag的說明進行嘗試,則可以連接。
要修復該Permission denied (publickey)
錯誤,以便您可以從主機中的任何位置ssh到該框,可以創建一個ssh密鑰,然后將公共密鑰復制到guest虛擬機上的authorised_keys文件中。 ssh-keygen
您可以選擇其他文件來保存密鑰。然后使用添加身份ssh-add <path to your key>
。
- 3 回答
- 0 關注
- 323 瀏覽
添加回答
舉報
0/150
提交
取消