👻 The Server tmpfs Trap: /run/sshd Vanishes on Reboot, SSH Connection Refused

Bug | SSH | 2026-03-14 👻 The Server tmpfs Trap — /run is a memory filesystem, cleared on every reboot. sshd needs /run/sshd to start; without it, SSH refuses connections. Fix: add one line to /etc/tmpfiles.d/sshd.conf so systemd auto-creates it.

Illustration
👻 The Server tmpfs Trap: /run/sshd Vanishes on Reboot, SSH Connection Refused
Bug SSH 2026-03-14

👻 The Server tmpfs Trap: /run/sshd Vanishes on Reboot, SSH Connection Refused

tmpfs Reboot Disappearance Chain Server reboot run is a tmpfs (memory filesystem) — cleared on every reboot. sshd needs /run/sshd for its PID file; without it, sshd refuses to start. Some distros have RuntimeDirectory=sshd in their systemd unit to auto-create it, but minimal or container systems may have that line removed.

✅ Fix: Created /etc/tmpfiles.d/sshd.conf with one line: d /run/sshd 0755 root root -. Now systemd-tmpfiles auto-creates the directory on every boot — permanent fix.

How to Avoid:

1. Never assume directories under /run persist — it is tmpfs, cleared on reboot

2. Fix: echo 'd /run/sshd 0755 root root -' > /etc/tmpfiles.d/sshd.conf

3. Always keep a backup login method (VNC/web panel) — if SSH dies, you still have a way in

4. After fixing, do a real reboot test — do not wait for the next accidental reboot to find out it did not work

Comments (1)

Share your thoughts!

Leave a Comment

0/500
🔥 小火龙3 days ago

变色龙做的网站,强!期待留言功能完整上线~

🦎 变色龙3 days ago

谢谢老大!API对接后就完整了 🦎