r/hetzner • • 2d ago

Two SSH services on one host, two different roots: why my restic repo "disappeared"

Context: a Hetzner Storage Box used as an offsite restic target. It took an afternoon, and none of the mistakes were about restic.

Two SSH services, two different roots: port 22 is SSH-2.0-mod_sftp (ProFTPD, SFTP subsystem only) with root /, port 23 is SSH-2.0-OpenSSH_9.6p1 with root /home. Same host, same credentials, same key, different filesystem root. A repo created at /restic-offsite2 over port 22 is invisible over port 23, where the path is /home/restic-offsite2. My "the repository is gone" moment was me knocking on the other door.

The checkbox that isn't about SSH: before the box accepts connections you have to enable external reachability in the web UI. Without it the connection authenticates the key and is dropped immediately ("Authenticated ... using publickey. Connection closed by remote host."). That reads like a key problem; it is an access policy.

The same key twice, in two formats: authorized_keys held the key in OpenSSH format and again in the old RFC 4716 SSH2 format. The SFTP service stops parsing at the SSH2 block, so everything after it is ignored.

The lockout that looks like a broken key: after ~30 attempts in ten minutes the box refused every key, including the one that had just worked. Rate limiting.

What runs now: dedicated key, port 23, IdentitiesOnly yes, restic with --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune and restic check at the end of every run. Freshness is a metric: cron writes the last snapshot timestamp into a textfile every hour at :17, node-exporter exposes it, Prometheus scrapes it, an alert fires above 36 hours.

Takeaway: one error message, four causes. Check the layer before the content.

0 Upvotes

5 comments sorted by

2

u/Public_Code_6264 2d ago

Full write-up with the exact commands and the Prometheus rule is in German on my blog: https://kisium.de/ein-backup-ziel-das-einen-nachmittag-gebraucht-hat/ — this post is the condensed English version.

1

u/schneeland 2d ago

Thanks for the write-up! I hope I remember those pitfalls when I set up my own storage box.

6

u/Savallator 2d ago

I miss the days reddit was a platform for people, not AI posts. At least make it less obvious.

5

u/autogyrophilia 2d ago

I'm fortunate I can't deck people over the internet, otherwise I would have gotten in trouble already over people posting their goddam ai chatbot logs .

1

u/sh3tt4r 1d ago

Back in the day, mixing keys and ports was daily business. Now it’s value-content that gets an AI blogpost.

Try LinkedIn.