sshd를 시작중에 아래와 같은 host key 파일을 읽을수 없다고 나오는 경우가 있다. (sshd가 실행은 되지만 로그인을 못한다.)

root@ruo91:~# /etc/init.d/ssh start
* Starting OpenBSD Secure Shell server sshd
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key

 

이 경우 ssh-keygen 을 이용하여 키 파일들을 만들어 주면 된다.

root@ruo91:~# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
root@ruo91:~# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase): 비번 입력을 요구하는데 별 필요 없으니 Enter 치면 된다.
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
63:1c:3f:85:2a:aa:38:90:6a:48:7a:d0:15:01:db:88 root@ruo91
The key’s randomart image is:
+–[ DSA 1024]—-+
|  ….           |
| . +.      .     |
|E o ..  . . .    |
|    .  . + .     |
| o .  . S o      |
|+..  . o . .     |
|*.  .            |
|=o..             |
|oo.              |
+—————–+

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 비번 입력을 요구하는데 별 필요 없으니 Enter 치면 된다.
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
cd:10:ae:e5:6d:db:19:f2:36:aa:9b:22:81:36:bd:f2 root@ruo91
The key’s randomart image is:
+–[ RSA 2048]—-+
|        .        |
|       . .       |
|        +        |
|       + =       |
|   o  . S * .    |
|  + o    . = o   |
| . . o    . *    |
|  . o .  . o .   |
|   oE. .+o.      |
+—————–+