红旗Linux桌面操作系统v11安装时系统没有默认生成ssh密钥文件,导致ssh无法远程登录红旗Linux桌面操作系统.
红旗Linux桌面操作系统v11安装完毕以后, 仅有三个如下文件:
# ls -lh /etc/ssh
总用量 584K
-rw-r--r-- 1 root root 552K 1月 31 2020 moduli
-rw-r--r-- 1 root root 1.6K 1月 31 2020 ssh_config
-rw-r--r-- 1 root root 3.2K 1月 31 2020 sshd_config
因为缺少ssh密钥文件,用户通过ssh远程无法登录红旗Linux桌面操作系统v11系统。 出错信息如下:
# grep error /var/log/auth.log
Mar 18 07:27:20 local-pc sshd[19777]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 07:27:20 local-pc sshd[19777]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 07:27:20 local-pc sshd[19777]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Mar 18 07:27:24 local-pc sshd[19781]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 07:27:24 local-pc sshd[19781]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 07:27:24 local-pc sshd[19781]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Mar 18 07:27:34 local-pc sshd[19784]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 07:27:34 local-pc sshd[19784]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 07:27:34 local-pc sshd[19784]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Mar 18 07:27:41 local-pc sshd[19787]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 07:27:41 local-pc sshd[19787]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 07:27:41 local-pc sshd[19787]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Mar 18 19:10:36 local-pc sshd[1579]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 19:10:36 local-pc sshd[1579]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 19:10:36 local-pc sshd[1579]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Mar 18 19:12:45 local-pc sshd[1699]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Mar 18 19:12:45 local-pc sshd[1699]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Mar 18 19:12:45 local-pc sshd[1699]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
运行 dpkg-reconfigure openss-server 命令可以生成所需要的ssh密钥文件。 其它Linux系统在安装时均自动生成ssh密钥文件。
# ls -lh /etc/ssh
总用量 584K
-rw-r--r-- 1 root root 552K 1月 31 2020 moduli
-rw-r--r-- 1 root root 1.6K 1月 31 2020 ssh_config
-rw-r--r-- 1 root root 3.2K 1月 31 2020 sshd_config
-rw------- 1 root root 505 3月 18 19:17 ssh_host_ecdsa_key
-rw-r--r-- 1 root root 175 3月 18 19:17 ssh_host_ecdsa_key.pub
-rw------- 1 root root 399 3月 18 19:17 ssh_host_ed25519_key
-rw-r--r-- 1 root root 95 3月 18 19:17 ssh_host_ed25519_key.pub
-rw------- 1 root root 1.8K 3月 18 19:17 ssh_host_rsa_key
-rw-r--r-- 1 root root 395 3月 18 19:17 ssh_host_rsa_key.pub
请解决这个问题。