WSL Linux开启SSH的一些问题及解决方法

xingyun86 2020-9-5 1132

1.centos使用yum时报 Error: rpmdb open failed的解决办法

原因是RPM数据库被破坏

重建数据库后恢复正常:(第三步可能报错,但是无需理会)

cd /var/lib/rpm/

for i in `ls | grep 'db.'`;do mv $i $i.bak;done

rpm --rebuilddb

yum clean all

2.在开启SSHD服务时报错.
sshd re-exec requires execution with an absolute path
用绝对路径启动,也报错如下:
Could not load host key: /etc/ssh/ssh_host_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 1. Could not load host key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available — exiting
解决过程:
#ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
#ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
#/usr/sbin/sshd

 
如果上述两个文件存在,仍然出现这个错误,那么试试 chmod 600 上述两个文件。之后应该可以解决。


×
打赏作者
最新回复 (0)
只看楼主
全部楼主
返回