Skip to content

Instantly share code, notes, and snippets.

@leafsummer
Forked from cxfksword/vagrant_reset_ssh
Created May 23, 2016 01:34
Show Gist options
  • Save leafsummer/6e39f2b38da708ec25e2e59692c2c5cd to your computer and use it in GitHub Desktop.
Save leafsummer/6e39f2b38da708ec25e2e59692c2c5cd to your computer and use it in GitHub Desktop.
vagrant ssh重置
默认vagrant私钥路径:
%userprofile%\.vagrant.d\insecure_private_key
当vagrant探测到是默认公钥时,vagrant up时会自动生成一个新的ssh key:
查看vagrant私钥路径:
λ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile d:/vagrant_dev/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
手工替换ssh key方法,要注意权限:
mkdir -p /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0700 /home/vagrant/.ssh
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment