解决 Could not load host key: /etc/ssh/ssh_host_rsa_key && 解决Permission denied (publickey)
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
- Restarting OpenBSD Secure Shell server 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
sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
然后三次enter
sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
然后三次enter
用ecdsa加密方式生成ssh密钥
sudo ssh-keygen -t ecdsa -P '' -f /etc/ssh/ssh_host_ecdsa_key
然后三次enter
sudo ssh-keygen -t ed25519 -P '' -f /etc/ssh/ssh_host_ed25519_key
然后三次enter
解决Permission denied (publickey)
解决问题
允许ssh密码登录权限
登录目标机器,打开/etc/ssh/sshd_config ,修改PasswordAuthentication no为:
PasswordAuthentication yes。
# sudo vim /etc/ssh/sshd_config
PasswordAuthentication yes
然后执行 sudo /etc/init.d/ssh restart