我正在尝试安装 openssh-server。最后我收到错误:
ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2020-02-06 13:52:20 +04; 9ms ago
Process: 17679 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)
dpkg: error processing package openssh-server (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up ssh-import-id (5.5-0ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.27) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Rules updated for profile 'Apache Full'
Firewall reloaded
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
检查你的 dpkg 日志/var/log/dpkg.log
。它可能会给你更多的信息。
通读安装后脚本,看看您是否能理解它在做什么。您可以在 中找到它/var/lib/dpkg/info/openssh-server.postinst
。
检查脚本失败的原因:
dpkg --configure -D 777 openssh-server
答案2
重启 ssh:
sudo service ssh restart
然后运行:
ssh localhost