set -ex sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers yum -y install wget # Make ssh faster by not waiting on DNS echo "UseDNS no" >> /etc/ssh/sshd_config # Vagrant specific date > /etc/vagrant_box_build_time # Add vagrant user /usr/sbin/groupadd vagrant /usr/sbin/useradd vagrant -g vagrant -G wheel echo "vagrant"|passwd --stdin vagrant echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant chmod 0440 /etc/sudoers.d/vagrant # Installing vagrant keys mkdir -pm 700 /home/vagrant/.ssh wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys chmod 0600 /home/vagrant/.ssh/authorized_keys chown -R vagrant /home/vagrant/.ssh yum -y clean all # Remove traces of mac address from network configuration sed -i /HWADDR/d /etc/sysconfig/network-scripts/ifcfg-eth0 rm /etc/udev/rules.d/70-persistent-net.rules # Zero out the free space to save space in the final image dd if=/dev/zero of=/filler bs=1M || rm /filler