Is there a default password to connect to vagrant when using `homestead ssh` for the first time?

前端 未结 5 2019
礼貌的吻别
礼貌的吻别 2021-01-30 05:02

I\'m trying to connect to vagrant via homestead ssh:

vagrant@127.0.0.1\'s password:

But my public key password doesn\'t work.

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-30 05:22

    I've a same problem. After move machine from restore of Time Machine, on another host. There problem it's that ssh key for vagrant it's not your key, it's a key on Homestead directory.

    Solution for me:

    • Use vagrant / vagrant for access ti VM of Homestead
    • vagrant ssh-config for see config of ssh

    run on terminal

    vagrant ssh-config
    Host default
    HostName 127.0.0.1
    User vagrant
    Port 2222
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
    PasswordAuthentication no
    IdentityFile "/Users/MYUSER/.vagrant.d/insecure_private_key"
    IdentitiesOnly yes
    LogLevel FATAL
    ForwardAgent yes
    

    Create a new pair of SSH keys

    ssh-keygen -f /Users/MYUSER/.vagrant.d/insecure_private_key
    

    Copy content of public key

    cat /Users/MYUSER/.vagrant.d/insecure_private_key.pub
    

    On other shell in Homestead VM Machine copy into authorized_keys

    vagrant@homestad:~$ echo 'CONTENT_PASTE_OF_PRIVATE_KEY' >> ~/.ssh/authorized_keys
    

    Now can access with vagrant ssh

提交回复
热议问题