Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash -eux
# Add vagrant user to sudoers
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
# UseDNS no to `sshd_config`.
sed /UseDNS/d /etc/ssh/sshd_config > /tmp/sshd_config
echo "UseDNS no" >> /tmp/sshd_config
mv /tmp/sshd_config /etc/ssh/sshd_config
chown root:root /etc/ssh/sshd_config
# Add Vagrant's insecure private key to authorized keys.
mkdir -m 0700 -p $HOME/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" >> $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
chown -R vagrant:vagrant $HOME/.ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment