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

前端 未结 5 2017
礼貌的吻别
礼貌的吻别 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

    0 讨论(0)
  • 2021-01-30 05:25

    On a Windows machine I was able to log to to ssh from git bash with
    ssh vagrant@VAGRANT_SERVER_IP without providing a password

    Using Bitvise SSH client on window
    Server host: VAGRANT_SERVER_IP
    Server port: 22
    Username: vagrant
    Password: vagrant

    0 讨论(0)
  • 2021-01-30 05:26

    After trying a lot of passwords and becoming totally confused why my public key password is not working I found out that I have to use vagrant as password.

    Maybe this info helps someone else too - that's because I've written it down here.

    Edit:
    According to the Vagrant documentation, there is usually a default password for the user vagrant which is vagrant.
    Read more on here: official website

    In recent versions however, they have moved to generating keypairs for each machine. If you would like to find out where that key is, you can run vagrant ssh -- -v. This will show the verbose output of the ssh login process. You should see a line like

    debug1: Trying private key: /home/aaron/Documents/VMs/.vagrant/machines/default/virtualbox/private_key
    
    0 讨论(0)
  • 2021-01-30 05:29

    By default Vagrant uses a generated private key to login, you can try this:

    ssh -l ubuntu -p 2222 -i .vagrant/machines/default/virtualbox/private_key 127.0.0.1
    
    0 讨论(0)
  • 2021-01-30 05:30

    This is the default working setup https://www.youtube.com/watch?v=XiD7JTCBdpI

    Use Connection Method: standard TCP/IP over ssh

    Then ssh hostname: 127.0.0.1:2222

    SSH Username: vagrant password vagrant

    MySQL Hostname: localhost

    Username: homestead password:secret

    0 讨论(0)
提交回复
热议问题