Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

[email protected]'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".

like image 270
stefan Avatar asked Apr 04 '15 19:04

stefan


People also ask

What is root password of vagrant box?

Root Password: "vagrant"

What is the vagrant login?

Command: vagrant login The login command is used to authenticate with the HashiCorp's Vagrant Cloud server. Logging in is only necessary if you are accessing protected boxes or using Vagrant Share.

How do I reset my vagrant password?

If you have lost access to your Vagrant Cloud account, use the reset password form on the login page to send yourself a link to reset your password.


5 Answers

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
like image 74
stefan Avatar answered Oct 02 '22 07:10

stefan


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

like image 45
abkrim Avatar answered Oct 02 '22 07:10

abkrim


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
like image 45
Raymond Avatar answered Oct 02 '22 08:10

Raymond


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

like image 44
mindsoul Avatar answered Oct 02 '22 09:10

mindsoul


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

like image 25
mag Avatar answered Oct 02 '22 09:10

mag