无法在 Ubuntu 服务器虚拟机(KVM)上安装 OpenSSH

无法在 Ubuntu 服务器虚拟机(KVM)上安装 OpenSSH

我在使用 KVM 的虚拟机 Ubuntu Server 16.04.01 上安装 OpenSSH 服务器时遇到了问题。

当我尝试安装 openssh-server 时,我收到以下响应:

Setting up openssh-server (1:7.2p2-4ubuntu2.1) ...
Creating SSH2 RSA key; this may take some time ...
2048 SHA256:i6IKfykW1E9hYmlHFLid3KksBI11oxCmKlbQjFOVNZY root@host (RSA)
Creating SSH2 DSA key; this may take some time ...
1024 SHA256:tGZN8I6qfTdAanbPy4fxj/ARLTPrrtQKWZXTQZWG/o4 root@host (DSA)
Creating SSH2 ECDSA key; this may take some time ...key_generate failed

dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 255
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人对如何解决这个问题有什么建议吗?

答案1

由于某些原因,脚本dpkg无法生成 ECDSA 密钥。其他主机密钥已成功生成,并且您的ssh服务器已成功安装,因此您在使用它时不会遇到任何问题。

如果遇到问题,请尝试启动ssh服务并检查其日志:

# systemctl start ssh
# journalctl -b -e

答案2

我正在升级到 openssh-server (1:6.6p1-2ubuntu2.8)。

我收到以下错误。

Creating SSH2 ECDSA key; this may take some time ...unknown key type ecdsa
dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我必须编辑 /var/lib/dpkg/info/openssh-server.postinst 并注释以下几行。

#create_key "Creating SSH2 ECDSA key; this may take some time ..." \
#       "$hostkeys" /etc/ssh/ssh_host_ecdsa_key -t ecdsa
#create_key "Creating SSH2 ED25519 key; this may take some time ..." \
#       "$hostkeys" /etc/ssh/ssh_host_ed25519_key -t ed25519

相关内容