我在我的流浪者盒子里有一个新用户(trusty64),我正试着ssh到它。我想登录我的用户名,而不是在vagrant
之后登录vagrant up
用户。
到目前为止我做了什么
ssh-keygen
ssh-copy-id -p 2222 -i shash@127.0.0.1
和Vagrantfile的部分看起来像这样
config.vm.box = "ubuntu/trusty64"
config.ssh.username = "shash"
config.ssh.forward_agent = true
config.ssh.private_key_path = "~/.ssh/authorized_keys"
我可以使用ssh -p '2222' 'shash@127.0.0.1'
直接登录,但是当我提供vagrant up
时,我一直收到以下错误
default: Warning: Connection timeout. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
任何帮助整理出来的确非常感谢。谢谢!
完整的设置指南非常有帮助
答案 0 :(得分:1)
当您指定'〜'时,vagrant文件将访问该用户的主目录。
config.ssh.private_key_path =" /home/shash/.ssh/authorized_keys"
放手一搏!
答案 1 :(得分:1)
将其添加到Vagrantfile:
Vagrant.configure("2") do |config|
config.ssh.private_key_path = "~/.ssh/id_rsa"
config.ssh.forward_agent = true
end