无法在自定义框上使用vagrant ssh
我已基于成功创建了一个自定义Vagrant框,但在尝试使用无法在自定义框上使用vagrant ssh,ssh,vagrant,Ssh,Vagrant,我已基于成功创建了一个自定义Vagrant框,但在尝试使用Vagrant ssh时收到此消息: ==> default: The machine you're attempting to SSH into is configured to use ==> default: password-based authentication. Vagrant can't script entering the ==> default: password for you. If you'r
Vagrant ssh
时收到此消息:
==> default: The machine you're attempting to SSH into is configured to use
==> default: password-based authentication. Vagrant can't script entering the
==> default: password for you. If you're prompted for a password, please enter
==> default: the same password you have configured in the Vagrantfile.
对该框的唯一更改是为其提供NginX。然后我用
vagrant package --vagrantfile <path_to_vagrantfile> --output nginx.box
然后我创建一个新目录,并使用vagrant init nginx
创建一个新的box实例。整个过程如中所述
当我使用vagrant up
时,所有操作都会按预期运行:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'nginx'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Custom_default_1503826905856_10643
==> 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) => 2222 (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:2222
default: SSH username: ubuntu
default: SSH auth method: password
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/blackslate/repos/Vagrant/Custom
然而,vagrant ssh
在这个问题的开头引发了这个消息。当我尝试手动ssh时,使用“ubuntu”作为ssh用户,“vagrant”作为密码,我得到以下结果:
ssh ubuntu@127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:PSnauymZfKi1HIRIKfez5wAnpPFJW9h3eC+TzxiiIWA.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
ubuntu@127.0.0.1's password:
Permission denied, please try again.
ubuntu@127.0.0.1's password:
如果我尝试ssh,我会得到类似的结果vagrant@127.0.0.1
:
ssh vagrant@127.0.0.1
vagrant@127.0.0.1's password:
Permission denied, please try again.
vagrant@127.0.0.1's password:
如果我打开VirtualBox GUI并直接与VM对话,情况也是如此
我试着按照说明去做,但我猜这是指一个旧版本的流浪汉
我希望我能够在
包
阶段进行更改,这样当我将定制的Vagrant box分发给其他开发人员时,Vagrant ssh
可以正常工作,无需事先处理任何文件。试试ssh-p 2222ubuntu@127.0.0.1
这给了我同样的结果:请求添加'[127.0.0.1]:2222'(ECDSA)到已知主机列表
,然后是权限被拒绝,请重试。
看起来虚拟机需要一个我不知道的密码。这很奇怪,vagrant可以在vagrant up期间通过ssh登录。您能在vagrant文件框文件中检查密码是否正确吗?然后尝试输入密码(应该是95bf98670a543bcd7bdd576c);如果您直接使用ssh命令,则需要提供正确的用户名(此框中为ubuntu,未定义流浪用户)config.ssh.username=“ubuntu”
config.ssh.password=“27f8dbe40a2e195f6bd6434a”
这是有效的:ssh-p2222ubuntu@127.0.0.1
然后ubuntu@127.0.0.1的密码:27f8dbe40a2e195f6bd6434a
tryssh-p2222ubuntu@127.0.0.1
这给了我同样的结果:请求添加'[127.0.0.1]:2222'(ECDSA)要查看已知主机列表,请重试。
看起来虚拟机需要一个我不知道的密码。这很奇怪,vagrant可以在vagrant up期间通过ssh登录。您能在vagrant文件框中检查密码是否正确吗?然后尝试输入密码(应该是95bf98670a543bcd7bdd576c);如果您直接使用ssh命令,则需要提供正确的用户名(此框中为ubuntu,未定义流浪用户)config.ssh.username=“ubuntu”
config.ssh.password=“27f8dbe40a2e195f6bd6434a”
这是有效的:ssh-p2222ubuntu@127.0.0.1
然后ubuntu@127.0.0.1用户密码:27f8dbe40a2e195f6bd6434a
ssh vagrant@127.0.0.1
vagrant@127.0.0.1's password:
Permission denied, please try again.
vagrant@127.0.0.1's password: