Howtos / Articles

Generate new SSH keys

SSH allows the use of encryption keys to be used to allow logging into a system instead of having to remember a plain text password.

This is great for use in scripts, and automated tasks, but can be a problem is anyone else ever gets the keys somehow.

If the keys become compromised, you must generate new SSH keys.

With the increasing use of virtual servers nowadays, if you are creating new servers based on a image file/backup, you may find the new server has the same keys as the original. You should generate new SSH keys on the new server if that is the case.

Generate new SSH keys:

ssh-keygen -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key 
ssh-keygen -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key

Restart the SSH server for the new keys to take effect.

Share this howto article!
  • Facebook
  • Twitter
  • Reddit
  • email

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>