使用 centos8:stream
镜像中启动 sshd
服务。
- 安装
openssh-server
yum install -y openssh-server
- 生成系统公钥
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
- 启动 sshd
/usr/sbin/sshd -D
参考:https://www.xmodulo.com/sshd-error-could-not-load-host-key.html