Windows中的自定义Vagrant SSH

时间:2017-09-20 23:29:09

标签: ssh vagrant putty

我正在尝试使用vagrant设置一个新的linux项目。我希望能够用腻子进入流浪盒,因为它具有复制粘贴功能。这是我到目前为止所做的:

导航到项目目的地 在命令提示符下键入

  

vagrant init

我在Vagrantfile中更改了以下内容:

config.vm.box = "base"

config.vm.box = "ubuntu/xenial64"

然后我将以下行添加到Vagrantfile中:

config.vm.network "private_network", ip: "192.168.10.12"
config.ssh.username = "test"
config.ssh.password = "password"

我保存了Vagrantfile

然后在命令提示符下输入

  

流浪汉

这是命令提示符中出现的内容:

==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170822.0.0'. The latest is version '20170919.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: geoserver_default_1505948268591_35426
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2201 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2201
    default: SSH username: test
    default: SSH auth method: password
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test@127.0.0.1's password:password
test@127.0.0.1's password:password
    default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test@127.0.0.1's password:
test@127.0.0.1's password:
    default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test@127.0.0.1's password:vagrant
test@127.0.0.1's password:vagrant

......我想要几分钟

    default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test@127.0.0.1's password:    default: Warning: Connection timeout. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test@127.0.0.1's password:Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

我尝试使用以下设置通过putty连接到机器,我收到网络错误:连接超时:

  

主机名:192.168.10.12

     

港口2201

     

连接类型:SSH

我尝试使用以下设置通过putty连接到机器,然后我连接到机器但是系统提示输入用户名和密码:

  

主机名:127.0.0.1

     

港口2201

     

连接类型:SSH

我尝试的用户名/密码组合是:

login as: test
password: password

我获得了拒绝访问

login as: ubuntu
password: vagrant

我获得了拒绝访问

如何设置流浪汉,以便我可以使用腻子?

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

虚拟机中没有测试用户,因此您无法使用此用户登录,您首先必须使用密码创建测试用户帐户,然后才能连接。

此框的ubuntu密码为95bf98670a543bcd7bdd576c。您可以在Mac上的“Vagrantfile”框中找到此信息,该文件位于~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox/Vagrantfile

您可以从Vagrantfile中删除用户名/密码信息,并在运行vagrant ssh时自动登录