正确" config.ssh.shell"流浪窗盒的价值?

时间:2015-07-23 11:55:08

标签: ssh vagrant vagrantfile

我正在使用Windows 7从主机启动流浪盒,这也是Windows 7的" vagrant up"命令。

Vagrantfile的内容:

Vagrant.configure(2) do |config|
  config.vm.box = "win7_base_test"
  config.vm.network "forwarded_port", guest: 88, host: 3088
  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"
  config.ssh.port = "3088"
  config.ssh.host = "127.0.0.1"
  config.ssh.shell = "cmd"
end

结果我得到了以下列表,最后出现错误:

vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 88 => 3088 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:3088
    default: SSH username: vagrant
    default: SSH auth method: password
    default: Warning: Connection timeout. Retrying...
The configured shell (config.ssh.shell) is invalid and unable
to properly execute commands. The most common cause for this is
using a shell that is unavailable on the system. Please verify
you're using the full path to the shell and that the shell is
executable by the SSH user.

注意:我可以通过执行" vagrant ssh"来连接到流浪盒。同时在那里发出shell命令。

因此我有一个问题:对于" config.ssh.shell"我是否使用了正确的值(" cmd")?参数?那里有什么价值?

谢谢!

3 个答案:

答案 0 :(得分:2)

一种选择是使用WinRM而不是SSH:将config.vm.communicator设置为“winrm”。

答案 1 :(得分:0)

根据Vagrant docsconfig.ssh.shell仅影响 Vagrant中使用的内容,而不会影响执行vagrant ssh时用作shell的内容。默认情况下它使用bash,除非你有特殊的需要改变它,否则保留它我认为。

答案 2 :(得分:0)

使用 config.ssh.shell = "powershell" 而不是 config.ssh.shell = "cmd"