我想通过homestead ssh
连接到vagrant:
[email protected]'s password:
但我的公钥密码不起作用。 我的Homestead.yaml看起来像这样:
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
我正在使用“Laravel Homestead版本2.0.14”和“Vagrant 1.7.2”。
在尝试了很多密码并且变得完全混淆为什么我的公钥密码不起作用之后我发现我必须使用vagrant
作为密码。
也许这个信息也可以帮助别人 - 那是因为我在这里写下来了。
编辑:
根据Vagrant文档,用户vagrant
有一个默认密码,即vagrant
。
在这里阅读更多信息:official website
我有同样的问题。从Time Machine的恢复移动机器后,在另一台主机上。有问题的是,流浪者的ssh键不是你的钥匙,它是Homestead目录上的一个关键。
我的解决方案:
在终端上运行
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
创建一对新的SSH密钥
ssh-keygen -f /Users/MYUSER/.vagrant.d/insecure_private_key
复制公钥的内容
cat /Users/MYUSER/.vagrant.d/insecure_private_key.pub
在Homestead VM Machine的其他shell上复制到authorized_keys
vagrant@homestad:~$ echo 'CONTENT_PASTE_OF_PRIVATE_KEY' >> ~/.ssh/authorized_keys
现在可以访问vagrant ssh
默认情况下,Vagrant使用生成的私钥登录,您可以尝试这样做:
ssh -l ubuntu -p 2222 -i .vagrant/machines/default/virtualbox/private_key 127.0.0.1
这是默认的工作设置https://www.youtube.com/watch?v=XiD7JTCBdpI
使用连接方法:standard TCP/IP over ssh
然后是ssh主机名:127.0.0.1:2222
SSH用户名:vagrant password vagrant
MySQL主机名:localhost
用户名:homestead password:secret