Last active
December 4, 2019 16:41
-
-
Save gregelin/11126436 to your computer and use it in GitHub Desktop.
basebox_config.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configure system for vagrant | |
service sshd start | |
chkconfig sshd on | |
groupadd admin # Per Vagrant's documentation | |
groupadd vagrant | |
useradd -g vagrant -G admin vagrant # Create the user, and add them to both groups | |
passwd vagrant | |
# specify **'vagrant'** for the password, per Vagrant's recommendations. | |
# Results in the following added to the end of the sudoer's file | |
# # Added for Vagrant Support | |
# Defaults env_keep += \"SSH_AUTH_SOCK\" | |
# %admin ALL=NOPASSWD:ALL" | |
echo -e "\n# Added for Vagrant Support\nDefaults env_keep += \"SSH_AUTH_SOCK\"\n%admin ALL=NOPASSWD:ALL" >> /etc/sudoers | |
# Attempts to comment out requiretty, per Vagrant's documentation | |
sed -ie 's/Defaults\s\+requiretty/#Defaults requiretty/g' /etc/sudoers | |
sed -ie 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config | |
mkdir ~vagrant/.ssh | |
curl -k https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > ~vagrant/.ssh/authorized_keys | |
chmod 0700 ~vagrant/.ssh | |
chmod 0600 ~vagrant/.ssh/authorized_keys | |
chown -R vagrant:vagrant ~vagrant/.ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment