vagrant@127.0.0.1: Permission denied

来源:2-5 Vagrant&VirtualBox for Windows

Ganjr

2020-07-29

vagrant up 之后运行 vagrant ssh 提示:

PS D:\VirtualBox VMs\CentOS7> vagrant ssh
vagrant@127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

该怎么解决?

写回答

2回答

麦兜搞IT

2020-07-31

可能是您的ssh key有问题,这样,您把这台host destroy掉吧。然后您修改下我们Vagrantfile所在文件夹里的setup.sh 这个脚本,在最后加上下面这几行

sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config    
sudo systemctl restart sshd

然后您再重新vagrant up

后面就可以通过密码登录了,密码是vagrant,比如 vagrant ssh,然后会提示您输入密码,密码就是vagrant

0
0

麦兜搞IT

2020-07-30

您好,vagrant status能看到机器正常up是吧?另外vagrant up的过程中有错误的log输出么

0
1
Ganjr
老师好, PS D:\VirtualBox VMs\CentOS7-with-Docker> vagrant status Current machine states: default running (virtualbox) The VM is running. To stop this VM, you can run `vagrant halt` to shut it down forcefully, or you can run `vagrant suspend` to simply suspend the virtual machine. In either case, to restart it again, simply run `vagrant up`. PS D:\VirtualBox VMs\CentOS7-with-Docker> vagrant ssh vagrant@127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). vagrant up 的时候有一段输出: ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest...
2020-07-30
共1条回复

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程