Originally Posted by
Tuna-Fish
Is there a fast way to tell a computer to regenerate all the keys? How should I start doing it?
Okay here's how I did it for SSH. Not the most elegant way but it works.
1. Login as root or use sudo.
2. Copy your ssh configs so you can put them back later:
Code:
cp /etc/ssh/ssh_config ./
cp /etc/ssh/sshd_config ./
3. Remove purge openssh-server:
Code:
apt-get purge openssh-server
4. Reinstall openssh-server:
Code:
apt-get install openssh-server
5. While installing watch for the following output. If you see it then all is good:
Code:
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
6. Move back your old configs:
Code:
mv sshd_config /etc/ssh/
mv ssh_config /etc/ssh/
7. Restart sshd
Code:
/etc/init.d/ssh restart
Note this won't work for feisty since it has no "apt-get purge", you will need to manually delete the keys in /etc/ssh/ instead.
Bookmarks