leafsummer
5/23/2016 - 1:34 AM

vagrant ssh重置

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