How should I regenerate ssh keys for OSX? The system is running El Capitan if that is relevant information.

(To clarify, I am not asking for ssh-keygen remote-server as a USER but to change the keys inside the serverside-sshd). In Ubuntu-Linux you delete /etc/ssh/ssh_host_* and dpkg-reconfigure openssh-server.

1 Answer 1


In Mac, you should be able to delete the /etc/ssh/ssh_host_* too and run ssh-keygen -A, which will generate the missing keys.

  • -A For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) for which host keys do not exist, generate the host keys with the default key file path, an empty passphrase, default bits for the key type, and default comment. This is used by /etc/rc to generate new host keys. Commented Sep 21, 2017 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .