2015-03-02 57 views
0

我有問題試圖在我的Windows機器內的Ubuntu的框中SSH。我下面遊民網站(http://docs.vagrantup.com/v2/getting-started/up.html無法連接從Windows主機在Ubuntu的Ubuntu盒子

軟件版本的基本入門教程:

流浪:1.7.2

VirtualBox的:4.3.22

SO:Windows 7的

Box:hashicorp/precise32

該場景:

當我打vagrant up一切按計劃進行:服務和虛擬機啓動,但在最後一步,這流浪漢測試SSH,它severals後,當我打開VirtualBox的GUI失敗Warning: Connection refused. Retrying...

在那之後,我可以登錄框並檢查openssh-server正在運行。當我嘗試通過命令行使用SSH我得到的錯誤:

ssh 127.0.0.1 -p 2222 

ssh: connect to host 127.0.0.1 port 2222: Bad file number 

當我打vagrant ssh(在INFO級別的日誌),我得到這樣的輸出:

INFO global: Vagrant version: 1.7.2 
INFO global: Ruby version: 2.0.0 
INFO global: RubyGems version: 2.0.14 
INFO global: VAGRANT_EXECUTABLE="C:\\dev\\tools\\Vagrant\\embedded\\gems\\gems\\vagrant-1.7.2\\bin\\vagrant" 
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\dev\\tools\\Vagrant\\embedded" 
INFO global: VAGRANT_INSTALLER_ENV="1" 
INFO global: VAGRANT_INSTALLER_VERSION="2" 
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1" 
INFO global: VAGRANT_LOG="INFO" 
INFO global: Plugins: 
INFO global: - bundler = 1.7.11 
INFO global: - mime-types = 1.25.1 
INFO global: - rdoc = 4.0.0 
INFO global: - rest-client = 1.6.8 
INFO global: - vagrant-share = 1.1.3 
INFO manager: Registered plugin: box command 
INFO manager: Registered plugin: destroy command 
INFO manager: Registered plugin: global-status command 
INFO manager: Registered plugin: halt command 
INFO manager: Registered plugin: help command 
INFO manager: Registered plugin: init command 
INFO manager: Registered plugin: list-commands command 
INFO manager: Registered plugin: vagrant-login 
INFO manager: Registered plugin: package command 
INFO manager: Registered plugin: plugin command 
INFO manager: Registered plugin: provision command 
INFO manager: Registered plugin: push command 
INFO manager: Registered plugin: rdp command 
INFO manager: Registered plugin: reload command 
INFO manager: Registered plugin: resume command 
INFO manager: Registered plugin: ssh command 
INFO manager: Registered plugin: ssh-config command 
INFO manager: Registered plugin: status command 
INFO manager: Registered plugin: suspend command 
INFO manager: Registered plugin: up command 
INFO manager: Registered plugin: version command 
INFO manager: Registered plugin: ssh communicator 
INFO manager: Registered plugin: winrm communicator 
INFO manager: Registered plugin: Arch guest 
INFO manager: Registered plugin: CoreOS guest 
INFO manager: Registered plugin: Darwin guest 
INFO manager: Registered plugin: Debian guest 
INFO manager: Registered plugin: ESXi guest. 
INFO manager: Registered plugin: Fedora guest 
INFO manager: Registered plugin: FreeBSD guest 
INFO manager: Registered plugin: Funtoo guest 
INFO manager: Registered plugin: Gentoo guest 
INFO manager: Registered plugin: Linux guest. 
INFO manager: Registered plugin: Mint guest 
INFO manager: Registered plugin: NetBSD guest 
INFO manager: Registered plugin: NixOS guest 
INFO manager: Registered plugin: OmniOS guest. 
INFO manager: Registered plugin: OpenBSD guest 
INFO manager: Registered plugin: PLD Linux guest 
INFO manager: Registered plugin: RedHat guest 
INFO manager: Registered plugin: SmartOS guest. 
INFO manager: Registered plugin: Solaris guest. 
INFO manager: Registered plugin: Solaris 11 guest. 
INFO manager: Registered plugin: SUSE guest 
INFO manager: Registered plugin: TinyCore Linux guest. 
INFO manager: Registered plugin: Ubuntu guest 
INFO manager: Registered plugin: Windows guest. 
INFO manager: Registered plugin: Arch host 
INFO manager: Registered plugin: BSD host 
INFO manager: Registered plugin: Mac OS X host 
INFO manager: Registered plugin: FreeBSD host 
INFO manager: Registered plugin: Gentoo host 
INFO manager: Registered plugin: Linux host 
INFO manager: Registered plugin: null host 
INFO manager: Registered plugin: Red Hat host 
INFO manager: Registered plugin: Slackware host 
INFO manager: Registered plugin: SUSE host 
INFO manager: Registered plugin: Windows host 
INFO manager: Registered plugin: kernel 
INFO manager: Registered plugin: kernel 
INFO manager: Registered plugin: docker-provider 
INFO manager: Registered plugin: Hyper-V provider 
INFO manager: Registered plugin: VirtualBox provider 
INFO manager: Registered plugin: ansible 
INFO manager: Registered plugin: CFEngine Provisioner 
INFO manager: Registered plugin: chef 
INFO manager: Registered plugin: docker 
INFO manager: Registered plugin: file 
INFO manager: Registered plugin: puppet 
INFO manager: Registered plugin: salt 
INFO manager: Registered plugin: shell 
INFO manager: Registered plugin: atlas 
INFO manager: Registered plugin: ftp 
INFO manager: Registered plugin: heroku 
INFO manager: Registered plugin: local-exec 
INFO manager: Registered plugin: noop 
INFO manager: Registered plugin: NFS synced folders 
INFO manager: Registered plugin: RSync synced folders 
INFO manager: Registered plugin: SMB synced folders 
INFO global: Loading plugins! 
INFO manager: Registered plugin: vagrant-share 
INFO vagrant: `vagrant` invoked: ["ssh"] 
INFO environment: Environment initialized (#<Vagrant::Environment:0x36893d0>) 
INFO environment: - cwd: C:/dev/local-server 
INFO environment: Home path: C:/Users/vitallan/.vagrant.d 
INFO environment: Local data path: C:/dev/local-server/.vagrant 
INFO environment: Running hook: environment_plugins_loaded 
INFO runner: Preparing hooks for middleware sequence... 
INFO runner: 1 hooks defined. 
INFO runner: Running action: #<Vagrant::Action::Builder:0x2c494c8> 
INFO environment: Running hook: environment_load 
INFO runner: Preparing hooks for middleware sequence... 
INFO runner: 1 hooks defined. 
INFO runner: Running action: #<Vagrant::Action::Builder:0x2cc93a0> 
INFO cli: CLI: [] "ssh" [] 
INFO loader: Set :root = #<Pathname:C:/dev/local-server/Vagrantfile> 
INFO loader: Loading configuration in order: [:home, :root] 
INFO command: Active machine found with name default. Using provider: virtualbox 
INFO environment: Getting machine: default (virtualbox) 
INFO environment: Uncached load of machine. 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"] 
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO loader: Set "27710496_machine_default" = [] 
INFO loader: Loading configuration in order: [:home, :root, "27710496_machine_default"] 
INFO box_collection: Box found: hashicorp/precise32 (virtualbox) 
INFO environment: Running hook: authenticate_box_url 
INFO host: Autodetecting host type for [#<Vagrant::Environment: C:/dev/local-server>] 
INFO host: Detected: windows! 
INFO runner: Preparing hooks for middleware sequence... 
INFO runner: 2 hooks defined. 
INFO runner: Running action: #<Vagrant::Action::Builder:0x376dbc8> 
INFO warden: Calling IN action: #<VagrantPlugins::LoginCommand::AddAuthentication:0x4727a18> 
INFO warden: Calling OUT action: #<VagrantPlugins::LoginCommand::AddAuthentication:0x4727a18> 
INFO loader: Set :"28616568_hashicorp/precise32_virtualbox" = #<Pathname:C:/Users/vitallan/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise32/1.0.0/virtualbox/Vagrantfile> 
INFO loader: Loading configuration in order: [:"28616568_hashicorp/precise32_virtualbox", :home, :root, "27710496_machine_default"] 
INFO machine: Initializing machine: default 
INFO machine: - Provider: VagrantPlugins::ProviderVirtualBox::Provider 
INFO machine: - Box: #<Vagrant::Box:0x474dfb0> 
INFO machine: - Data dir: C:/dev/local-server/.vagrant/machines/default/virtualbox 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"] 
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b"] 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO command: With machine: default (#<VagrantPlugins::ProviderVirtualBox::Provider:0x487e4f8 @logger=#<Log4r::Logger:0x487e4c8 @fullname="vagrant::provider::virtualbox", @outputters=[], @additive=true, @name="virtualbox", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @machine=#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>, @driver=#<VagrantPlugins::ProviderVirtualBox::Driver::Meta:0x4897560 @logger=#<Log4r::Logger:0x48a4148 @fullname="vagrant::provider::virtualbox::meta", @outputters=[], @additive=true, @name="meta", @path="vagrant::provider::virtualbox", @parent=#<Log4r::Logger:0x487e4c8 @fullname="vagrant::provider::virtualbox", @outputters=[], @additive=true, @name="virtualbox", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @level=2, @trace=false>, @interrupted=false, @vboxmanage_path="C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", @uuid="d2575078-1bc6-448b-9c70-04e21249f33b", @version="4.3.22", @driver=#<VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3:0x48d4568 @logger=#<Log4r::Logger:0x48ed108 @fullname="vagrant::provider::virtualbox_4_3", @outputters=[], @additive=true, @name="virtualbox_4_3", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @interrupted=false, @vboxmanage_path="C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", @uuid="d2575078-1bc6-448b-9c70-04e21249f33b">>, @cap_logger=#<Log4r::Logger:0x491d600 @fullname="vagrant::capability_host::vagrantplugins::providervirtualbox::provider", @outputters=[], @additive=true, @name="provider", @path="vagrant::capability_host::vagrantplugins::providervirtualbox", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @cap_host_chain=[[:virtualbox, #<#<Class:0x491d8d0>:0x4b76518>]], @cap_args=[#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>], @cap_caps={:docker=>#<Vagrant::Registry:0x491d7f8 @items={:public_address=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/plugin.rb:54>, :proxy_machine=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/plugin.rb:59>}, @results_cache={}>, :hyperv=>#<Vagrant::Registry:0x491d780 @items={:public_address=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/hyperv/plugin.rb:25>}, @results_cache={}>, :virtualbox=>#<Vagrant::Registry:0x491d708 @items={:forwarded_ports=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:27>, :nic_mac_addresses=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:32>, :public_address=>#<Proc:[email protected]:/dev/tools/Vagrant/embedded/gems/gems/vagrant-share-1.1.3/lib/vagrant-share.rb:39>}, @results_cache={}>}>) 
INFO machine: Calling action: ssh on provider VirtualBox (d2575078-1bc6-448b-9c70-04e21249f33b) 
INFO runner: Preparing hooks for middleware sequence... 
INFO runner: 1 hooks defined. 
INFO runner: Running action: #<Vagrant::Action::Builder:0x460fde8> 
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckVirtualbox:0x4686480> 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"] 
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3 
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "list", "hostonlyifs"] 
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckCreated:0x4686468> 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckAccessible:0x4686450> 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckRunning:0x4686438> 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SSHExec:0x4686420> 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"] 
INFO subprocess: Starting process: ["C:\\Program Files (x86)\\Git\\bin/ssh.EXE"] 
INFO ssh: Invoking SSH: ["[email protected]", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "C:/Users/vitallan/.vagrant.d/insecure_private_key"] 

有誰知道我可以在我的箱子裏ssh?

編輯:我想開擴新forwardding門(如@ user1389596建議),但它仍然不工作

回答

0

嗯,SSH 127.0.0.1是環回地址(在同一臺機器)。你不應該使用你的ubuntu服務器intead的本地LAN IP嗎?

+0

與流浪漢的端口轉發我不太確定。打到'vagrant ssh-config'返回 '主機默認 主機名127.0.0.1 用戶vagrant 端口2222' – 2015-03-02 19:19:05

+0

啊,連接到流浪漢。它是否應該使用命令'vagrant ssh'?例如http://stackoverflow.com/questions/28757642/vagrant-ssh-connect-to-host-127-0-0-12222-port-22-bad-file-number – 2015-03-02 19:25:19

+0

也嘗試過。正如我在問題中所說的,當我打'流浪ssh'時,它什麼都不做。將日誌放入INFO級別會輸出我提出的所有問題。 – 2015-03-02 19:31:32