Windows 中的自定义 Vagrant SSH
Custom Vagrant SSH in Windows
我正在尝试使用 vagrant 设置一个新的 linux 项目。我希望能够使用 putty ssh 进入 vagrant box,因为它具有复制粘贴功能。这是我到目前为止所做的:
导航到项目目的地
在命令提示符中输入
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
然后在命令提示符下输入
vagrant up
这是命令提示符中出现的内容:
==> 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 连接到机器,但出现网络错误:连接超时:
Host Name: 192.168.10.12
Port 2201
Connection Type: SSH
我尝试使用以下设置通过 putty 连接到机器,我连接到机器但系统提示我输入用户名和密码:
Host Name: 127.0.0.1
Port 2201
Connection Type: SSH
我尝试的username/password组合是:
login as: test
password: password
我收到拒绝访问
login as: ubuntu
password: vagrant
我收到拒绝访问
如何设置 vagrant 以便我可以使用 putty ssh 登录?
感谢您的所有帮助!
VM 中没有测试用户,因此您无法使用该用户登录,您必须先创建一个测试用户帐户并输入密码,然后才能连接。
此邮箱的 ubuntu 密码是 95bf98670a543bcd7bdd576c
。您可以在盒子的 Vagrantfile 中找到此信息,在 Mac 它位于 ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox/Vagrantfile
下
您只需从您的 Vagrantfile 中删除 username/password 信息,您将在 运行 vagrant ssh
时自动登录
我正在尝试使用 vagrant 设置一个新的 linux 项目。我希望能够使用 putty ssh 进入 vagrant box,因为它具有复制粘贴功能。这是我到目前为止所做的:
导航到项目目的地 在命令提示符中输入
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
然后在命令提示符下输入
vagrant up
这是命令提示符中出现的内容:
==> 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 连接到机器,但出现网络错误:连接超时:
Host Name: 192.168.10.12
Port 2201
Connection Type: SSH
我尝试使用以下设置通过 putty 连接到机器,我连接到机器但系统提示我输入用户名和密码:
Host Name: 127.0.0.1
Port 2201
Connection Type: SSH
我尝试的username/password组合是:
login as: test
password: password
我收到拒绝访问
login as: ubuntu
password: vagrant
我收到拒绝访问
如何设置 vagrant 以便我可以使用 putty ssh 登录?
感谢您的所有帮助!
VM 中没有测试用户,因此您无法使用该用户登录,您必须先创建一个测试用户帐户并输入密码,然后才能连接。
此邮箱的 ubuntu 密码是 95bf98670a543bcd7bdd576c
。您可以在盒子的 Vagrantfile 中找到此信息,在 Mac 它位于 ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox/Vagrantfile
您只需从您的 Vagrantfile 中删除 username/password 信息,您将在 运行 vagrant ssh