Skip to content

Instantly share code, notes, and snippets.

@uggedal
Last active December 17, 2015 21:48
Show Gist options
  • Save uggedal/5677058 to your computer and use it in GitHub Desktop.
Save uggedal/5677058 to your computer and use it in GitHub Desktop.
set -e
# Required packages:
apt-get -y install ssh
# Vagrant user:
cat <<EOF > /etc/sudoers
%vagrant ALL=(ALL) NOPASSWD: ALL
EOF
groupadd -g 500 vagrant
useradd -m -r -u 500 -g 500 vagrant
passwd -d vagrant
passwd vagrant<<EOF
vagrant
vagrant
EOF
# Virtualbox guest additions:
apt-get -y install dkms xserver-xorg xserver-xorg-core
apt-get -y install linux-headers-$(uname -r) build-essential
VBOX_VERSION=4.2.12
curl -L http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso > /tmp/vbga.iso
mount -o loop /tmp/vbga.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm /tmp/vbga.iso
# Insecure vagrant ssh key:
apt-get -y install curl
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
curl -sk https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > /home/vagrant/.ssh/authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant: /home/vagrant/.ssh
# Cleanup:
apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y remove curl
apt-get -y autoremove
apt-get clean
rm /var/lib/dhcp/*
unset HISTFILE
[ -f /root/.bash_history ] && rm /root/.bash_history
find /var/log -type f | while read f; do echo -ne '' > $f; done;
dd if=/dev/zero of=/ZERO || rm /ZERO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment