docker centos:last 开启sshd 遇到的证书问题

启动sshd:
# /usr/sbin/sshd
一、问题描述

这时报以下错误: [root@ xxx/]# /usr/sbin/sshd Could not load host key: /etc/ssh/ssh_host_rsa_key Could not load host key: /etc/ssh/ssh_host_ecdsa_key Could not load host key: /etc/ssh/ssh_host_ed25519_key

二、解决方案
1.执行以下命令解决:
[root@xxx/]# ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ''    
[root@xxx/]# ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
[root@xxx/]# ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key  -N '' 
2.然后,修改 /etc/ssh/sshd_config 配置信息:

UsePAM yes 改为 UsePAM no 
UsePrivilegeSeparation sandbox 改为 UsePrivilegeSeparation no

[root@xx/]# sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config
[root@xx/]# sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config

修改完后,重新启动sshd
[root@xx/]# /usr/sbin/sshd

参考:http://blog.csdn.net/waixin/article/details/50212079

posted @ 2017-03-22 12:51  b̶i̶n̶g̶.̶  阅读(809)  评论(0编辑  收藏  举报