Skip to content

Instantly share code, notes, and snippets.

@cxfksword
Created January 26, 2015 03:29
Show Gist options
  • Save cxfksword/35e594cc82a5f9a9e1e0 to your computer and use it in GitHub Desktop.
Save cxfksword/35e594cc82a5f9a9e1e0 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