Skip to content

Instantly share code, notes, and snippets.

@wokamoto

wokamoto/clear.sh

Last active Aug 29, 2015
Embed
What would you like to do?
[AWS] AMI 作る前に最低限やっておくこと
#!/bin/sh
rm -rf /tmp/*
rm -f /etc/ssh/ssh_host_*
if [ -d /var/log ]; then
find /var/log -type f -print | xargs -L1 /bin/cp /dev/null
fi
if [ -d /var/spool/mail ]; then
find /var/spool/mail -type f -print | xargs -L1 /bin/cp /dev/null
fi
/bin/cp /dev/null /root/.ssh/authorized_keys
/bin/cp /dev/null /root/.bash_history
if [ -f /root/.mysql_history ]; then
/bin/cp /dev/null /root/.mysql_history
fi
if [ -d /home/ec2-user ]; then
/bin/cp /dev/null /home/ec2-user/.ssh/authorized_keys
/bin/cp /dev/null /home/ec2-user/.bash_history
if [ -f /home/ec2-user/.mysql_history ]; then
/bin/cp /dev/null /home/ec2-user/.mysql_history
fi
fi
history -c
echo "clear!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.