Skip to content

Instantly share code, notes, and snippets.

@ay65535
Last active August 29, 2015 14:15
Show Gist options
  • Save ay65535/a39cee434cd3e3ceaf94 to your computer and use it in GitHub Desktop.
Save ay65535/a39cee434cd3e3ceaf94 to your computer and use it in GitHub Desktop.
#!/bin/sh
# http://cloudstack-administration.readthedocs.org/en/4.3/templates.html#system-preparation-for-linux
# cat /var/lib/dhcp/dhclient.eth0.leases
# sudo vi /etc/dhcp/dhclient-exit-hooks.d/sethostname
#cp /etc/hosts.dhcp.bak .
#sudo mv /etc/hosts.dhcp.bak /etc/hosts
sudo rm /etc/hosts.dhcp.bak
rm /home/user/.bash_history
sudo aptitude clean
sudo rm -f /etc/udev/rules.d/70*
sudo rm -f /var/lib/dhcp/dhclient.*
sudo rm -f /etc/ssh/*key*
rm /home/user/.bash_history
sudo sh -c "cat /dev/null > /var/log/audit/audit.log 2>/dev/null"
sudo sh -c "cat /dev/null > /var/log/wtmp 2>/dev/null"
sudo sh -c "logrotate -f /etc/logrotate.conf 2>/dev/null"
sudo sh -c "rm -f /var/log/*-* /var/log/*.gz 2>/dev/null"
rm /home/user/.bash_history
sudo hostname localhost
sudo sh -c "echo 'localhost' > /etc/hostname"
#passwd --expire root
rm /home/user/.bash_history
history -c
unset HISTFILE
rm /home/user/.bash_history
#sudo halt -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment