也许颓废也是 ... 另一种美
一个学习了N年还是小白的网络爱好者 ...

Missing privilege separation directory: /var/run/sshd

今天服务器重启后,ssh 连接不上。遂登录VPS管理端口发现 SSH 启动错误。
然后百度 google了一番发现的问题源头是在于。
服务器重启的时候会丢失 /var/run/sshd 这个目录,网上提供的办法都试了一遍,基本都是临时解决
但是重启服务器后依然连接不上。
而且这个问题,应该主要发生在 OVZ 、ubuntu 16.04 上

错误排查提示提示如下:
1、

root@Vpsname:/# systemctl status sshd.service
● ssh.service – OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Sat 2019-02-02 14:58:51 CST; 3min 55s ago
Process: 948 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)

Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Unit entered failed state.
Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Failed with result ‘exit-code’.
Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Feb 02 14:58:51 Vpsname systemd[1]: Stopped OpenBSD Secure Shell server.
Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Start request repeated too quickly.
Feb 02 14:58:51 Vpsname systemd[1]: Failed to start OpenBSD Secure Shell server.
Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Unit entered failed state.
Feb 02 14:58:51 Vpsname systemd[1]: ssh.service: Failed with result ‘start-limit-hit’.

2、

root@Vpsname:/# /usr/sbin/sshd -T
/usr/sbin/sshd: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /usr/sbin/sshd)
/usr/sbin/sshd: /usr/local/openssl/lib/libcrypto.so.1.0.0: no version information available (required by /usr/sbin/sshd)
Missing privilege separation directory: /var/run/sshd

 

临时解决办法:

mkdir /var/run/sshd
chmod 0755 /var/run/sshd
systemctl status sshd.service

但是重启后问题依旧。

没有办法的根本解决办法:

crontab -e
@reboot mkdir -p -m0755 /var/run/sshd && systemctl restart sshd.service

真的是简单粗暴。

参考:
1、https://i.rexdf.org/blog/2018/11/22/ji-lu-yi-ci-ovzxia-de-sshfu-wu-qi-dong-shi-bai/
2、https://a2z.ink/ubuntu-reboot-ssh-stop-syncthingv1-stop/
3、https://talk.plesk.com/threads/missing-privilege-separation-directory-var-run-sshd.350438/
4、https://blog.csdn.net/woailyoo0000/article/details/79782986
5、https://askubuntu.com/questions/891954/ubuntu-16-04-lts-sshd-restart-problem
6、https://unix.stackexchange.com/questions/384779/how-to-fix-exit-status-127
7、https://askubuntu.com/questions/53463/ssh-problem-after-update

未经允许不得转载:颓废的美 » Missing privilege separation directory: /var/run/sshd
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址