Is there a default password to connect to vagrant when using `homestead ssh` for the first time?
Solution 1
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
Solution 2
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
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
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
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
Related videos on Youtube
stefan
I have studied at a college for electronic data processing and organization My first program i have written in logo (turtle) After this I have learned C, C++, Assembler, Visual Basic, VBA, Java, PHP, C#, ... and some other languages I have worked with different databases like Oracle (SQL, PL/SQL), MS Access, MS SQL, MySQL and mongoDB Now I try to help others by answering their questions
Updated on November 25, 2021Comments
-
stefan over 2 years
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".
-
JustAMartin about 8 yearsThanks, this saved my day on Windows machine where I already had authorization keys for Git which could not be used by Putty without dealing with conversion tools etc. One more confusion factor was insecure_private_key of Vagrant itself which turned out to be unused by Homestead, but I didn't realize that and spent much time figuring out which key should I use. So finally I just gave up and used
vagrant
password, as you suggested. -
Admin about 7 yearsthis was a great answer; my issue when connecting was that I had selected the wrong identity-file, the IdentityFile listing in
vagrant ssh-config
is the correct path