当前位置: 首页 > 知识库问答 >
问题:

无法在Ubuntu box中从Windows主机连接到流浪者

宇文航
2023-03-14

我在尝试在Windows机器内的ubuntu盒子中ssh时遇到问题。我正在遵循流浪汉网站(http://docs.vagrantup.com/v2/getting-started/up.html)的基本入门教程

软件版本:

流浪汉: 1.7.2

Virtualbox:4.3.22

SO:Windows 7

方框:hashicorp/precise32

场景:

当我点击“代码”流浪者向上时,一切都按计划进行:服务和虚拟机启动,但在最后一步,哪个流浪者测试ssh,在几个<代码>警告后失败:连接被拒绝。正在重试…

之后,当我打开Virtualbox GUI时,我可以登录该框并检查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:0x3806538@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/plugin.rb:54>, :proxy_machine=>#<Proc:0x3806490@C:/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:0x380ed10@C:/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:0x383fcd0@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:27>, :nic_mac_addresses=>#<Proc:0x383fc58@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:32>, :public_address=>#<Proc:0x2a38508@C:/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: ["vagrant@127.0.0.1", "-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吗?

编辑:我尝试打开新的转发门(就像@user1389596建议的那样),但仍然不起作用。

共有1个答案

栾耀
2023-03-14

嗯,ssh127.0.0.1是环回地址(同一台机器)。你不应该使用你的ubuntu服务器接口的本地局域网IP吗?

 类似资料:
  • Master:运行Ubuntu14.10Docker(1.9)运行Jenkins映像的Azure VM我在Azure VM上添加了端口8080(用于UI)和50000(用于从机)作为endpoint。 从:Windows 10(通过BootCamp在Mac上运行)将防火墙配置为允许端口50000上的入站和出站流量(从jnlp似乎正在使用这个端口)。 我可以通过网络访问我的詹金斯大师安装。我正试图在

  • SMTP错误:无法连接到SMTP主机。无法发送消息。 邮件程序错误:SMTP错误:无法连接到SMTP主机。 我似乎找不到让PHPMailer在CentOS下工作的方法。邮件在XAMPP的Windows下工作正常,但我总是在Linux下遇到这个错误。 SMTP服务器是一个在端口25上侦听的Lotus Domino,CentOS机器根本没有防火墙,奇怪的是,即使是mail()也不能工作。它不返回任何内

  • 我在windows server 2008 R2上遇到以下错误,并且在我的防火墙入站规则上启用了: 请救命!!

  • 我试图从Windows运行一个HBase Java客户端程序。我所拥有的只有1)一个没有任何编译器错误的Java程序2)hbase-site.xml(我没有其他HDFS或HBase配置文件。只有上面的一个。)当我运行程序时,我得到了以下错误--在最后一个块中给出的。我错过了什么吗?我在这里都给出了。

  • 厘斯7.8 docker run -d -p 8080:80 --name nginxtest nginx docker ps CONTAINER ID Image PORTS NAMES xxxxxxxx nginx 0.0.0.0:8080- curl localhost:8080 < br > curl:(56)Recv失败:连接被对等方重置 netstat-tulpn<br>tcp6 0

  • 问题内容: 以下是我发送邮件的代码: 但是当我运行代码时,它给了我以下异常。 当我ping到它时,它给我的答复没有任何问题。我在用 请帮我解决这个问题。 问题答案: 这是这两行让我感到困扰的问题: 并添加了这一行: 删除并添加以上代码行后,它可以正常工作。