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

SshVagrantLaravel 5Homestead

Ssh Problem Overview


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.
My Homestead.yaml looks like this:

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

I'm using "Laravel Homestead version 2.0.14" with "Vagrant 1.7.2".

Ssh Solutions


Solution 1 - Ssh

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][1]

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

[1]: https://www.vagrantup.com/docs/boxes/base.html#default-user-settings "official websitequot;"

Solution 2 - Ssh

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

Solution 3 - Ssh

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

Solution 4 - Ssh

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

Solution 5 - Ssh

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

Solution 6 - Ssh

In my case I learned through the output from:

vagrant ssh -- -v

The problem was my private key generated by vagrant was ignored because the permissions were too open (on Windows 10).

The log lines were:

> Permissions for 'C:/My Folder/.vagrant/machines/default/virtualbox/private_key' > are too open. It is required that your private key files are NOT > accessible by others. This private key will be ignored.

So in Windows Explorer, navigate to the private key for the VM on the path in your log, right-click and select properties. Then go to the Security tab and click the Advanced button. Next, Add your specific user with Full Control, and then select whichever group also has permissions and click the Disable inheritance button at the bottom of the dialog and chose to remove all inheritance. You should be left with just your own user account having permissions on the private_key file. Click Apply and close the properties dialog, then try vagrant ssh again. It should now let you in without asking for a password.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionstefanView Question on Stackoverflow
Solution 1 - SshstefanView Answer on Stackoverflow
Solution 2 - SshabkrimView Answer on Stackoverflow
Solution 3 - SshRaymondView Answer on Stackoverflow
Solution 4 - SshmindsoulView Answer on Stackoverflow
Solution 5 - SshmagView Answer on Stackoverflow
Solution 6 - Sshuser2790936View Answer on Stackoverflow