# Regenerate ssh host key [Closed]

## richcoosa19

I have been having a problem getting horde-imp working properly so I tried to sync and update my world profile.  After this ssh seemed to be one of the packages that got updated, it didn't work any more.  When I tried the restart the service, I never saw it in my ps list.  So I tried to emerge ssh again, and it failed.  Then I emerged -u world again and after that, the ssh program compiled correctly.  However, when I try to run the startup script, ssh says it can't find the host key since I deleted it while I was doing my troubleshooting (obviously that was not the problem).

How do I regenerate the keys needed to startup sshd?

I know during the initial installation, the key was automatically created, and I was thinking when I deleted the keys it would regenerate it.  Now when I try to startup the ssh daemon it says the key was not found/valid.  :Rolling Eyes: Last edited by richcoosa19 on Thu Oct 05, 2006 1:55 pm; edited 1 time in total

----------

## Cooldogin

The sshd init script has a gen_keys part that should regen the keys if any of them are not found but if its not working then try these.

```

/usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N

/usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N

/usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N

```

Pulled those right from the init script.

----------

## richcoosa19

Sweet, thanks man.  I was going to go through the init script and try to find it but it just got too late last night.  Also I obviously can't ssh into it since I'm having a problem with ssh lol.   :Laughing: 

----------

