sshd 启动、运行并正常工作,但只能运行一次。如果我尝试在第二个 ssh 终端会话上登录,则会被拒绝:
ssh: connect to host dmz port 22: Network is unreachable
或者当我退出 ssh 时,服务就会终止:
Jun 25 10:47:16 dmz sshd[29221]: Received disconnect from 10.0.0.101 port 57874:11: disconnected by user
Jun 25 10:47:16 dmz sshd[29221]: Disconnected from 10.0.0.101 port 57874
Jun 25 10:47:16 dmz sshd[29221]: debug1: do_cleanup
Jun 25 10:47:16 dmz sshd[29221]: debug1: do_cleanup
Jun 25 10:47:16 dmz sshd[29221]: debug1: PAM: cleanup
Jun 25 10:47:16 dmz sshd[29221]: debug1: PAM: closing session
Jun 25 10:47:16 dmz sshd[29221]: debug1: PAM: deleting credentials
Jun 25 10:47:16 dmz sshd[29221]: debug1: audit_event: unhandled event 12
Jun 25 10:47:16 dmz systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Jun 25 10:47:16 dmz systemd[1]: ssh.service: Unit entered failed state.
Jun 25 10:47:16 dmz systemd[1]: ssh.service: Failed with result 'exit-code'.
答案1
回顾之前我刚刚看到的内容:
Jun 25 10:46:44 dmz sshd[29221]: debug1: Server will not fork when running in debugging mode.
......这看起来相当可疑。
检查我看到的流程:
/etc/sbin/sshd -D -d
检查 /etc/default/ssh 我看到:
SSHD_OPTS="-d"
我已将其注释掉。
我不知道为什么要设置它,我不记得曾经设置过它,并且 ssh 工作正常,直到我将 14:04LTS 升级到 16:04LTS。
ssh 现在可以按预期工作。