【发布时间】:2013-01-25 17:12:59
【问题描述】:
我使用 Vagrant 在 Windows 主机上创建了一个 CentOS VM 并连接到它,到目前为止一切顺利。
接下来我想使用 Chef 在创建的 VM 上配置堆栈。我尝试使用本地目录食谱以及提供食谱的 url,但这可能会失败,因为它无法 ssh 到访客框,从错误中可以看出:
SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.
所以我的第一个问题是:
1) 我如何确保 SSH 在 Windows 主机中启动来宾操作系统的同一窗口中工作,以便所有脚本都能正常执行?
现在当我在 vagrantfile 的下面一行评论时
config.ssh.username = "root"
上面的错误消失了,但我得到了另一个错误:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -t vboxsf -o uid=id -u vagrant,gid=id -g vagrant v-csr-2 /tmp/vagrant-chef-1/chef-solo-2/roles
这是因为用户 vagrant 在 box 上没有足够的访问权限,这是我的第二个问题:
2) 如何指示 Vagrant 以 sudo 或 su 访问权限运行所有命令?
【问题讨论】:
标签: windows ssh chef-infra vagrant