请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

vagrant@127.0.0.1: Permission denied

vagrant up 之后运行 vagrant ssh 提示:

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

该怎么解决?

正在回答 回答被采纳积分+3

2回答

麦兜搞IT 2020-07-31 06:15:02

可能是您的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 回复 有任何疑惑可以回复我~
麦兜搞IT 2020-07-30 06:10:50

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

0 回复 有任何疑惑可以回复我~
  • 提问者 Ganjr #1
    老师好,
    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 11:48:22
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信