Skip to content

Instantly share code, notes, and snippets.

@vdel26
Last active December 21, 2015 20:58
Show Gist options
  • Save vdel26/6364892 to your computer and use it in GitHub Desktop.
Save vdel26/6364892 to your computer and use it in GitHub Desktop.
Clean instance before pubslihing custom AMI
# erase bash history
find /root/.*history /home/*/.*history -exec rm -f {} \;
# erase ssh authorized keys
find / -name "authorized_keys" –exec rm –f {} \;
sudo rm /etc/ssg/ssh_host_dsa_key* /etc/ssh/ssh_host_rsa_key* /etc/ssh/ssh_host_key* /etc/ssh/ssh_host_ecdsa_key*
# disable root and ubuntu user password
sudo passwd -l root
passwd -l ubuntu
# - make sure to remove any other passwords
# - configure sshd to allow only public key authentication
# in sshd_config:
# PubkeyAuthentication yes
# PasswordAuthentication no
# use rkhunter to check for Linux rootkit vulnerabilities
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment