Prepare AMI for AWS Marketplace – Reset Linux ec2 Image – delete public keys, etc

When preparing a public AMI for AWS EC2, you need to delete lots of security stuff, like public keys, hosts and history.

sudo rm ~/.ssh/authorized_keys /home/ec2-user/.ssh/authorized_keys /root/.ssh/authorized_keys /root/.ssh/known_hosts ~/.ssh/known_hosts /home/ec2-user/.ssh/known_hosts

sudo shred -u /etc/ssh/*_key /etc/ssh/*

sudo shred -u ~/.*history

Also see from our Blog:

Reset AWS AMI Windows 2016 and 2019 Password for use in Marketplace

Follow and this

Hits: 29