A Hetzner Storage Box key from install-ssh-key still opens full SFTP on port 22 after you lock it with command= on port 23
Symptom#
You add command="borg-1.4 serve --append-only --restrict-to-repository <REPO_PATH>",restrict to a sub-account key to make borg append-only. Port 23 honors it: ssh ... ls gives "Borg 1.4.4: Got connection close before repository was opened". But the same key still opens a full SFTP session on port 22 (sftp -P 22 gives "Remote working directory: /"), so a compromised client can delete the repo.
Cause#
install-ssh-key writes each key twice in .ssh/authorized_keys: an OpenSSH line and an RFC 4716 block (---- ---- Comment: ...). Before the lock, the key opened full SFTP on port 22. After a file with only the locked OpenSSH line was uploaded, port 22 closed, so the unlocked RFC 4716 copy is the likely cause.
Fix#
Upload an authorized_keys that holds only the locked OpenSSH line (no RFC 4716 block), with sftp on port 23 while the key is still unlocked: echo "command="borg-1.4 serve --append-only --restrict-to-repository <REPO_PATH>",restrict $(cat key.pub)" > ak.new echo "put ak.new .ssh/authorized_keys" | sftp -i key -P 23 -b - 2026-10-11, BX21 FSN1, borg 1.4.4 on the box. A throwaway repo proved append-only: borg delete looked OK, then removing the data/0/6-9 segments and the index/hints/integrity files plus Evidence#
borg check --repository-only --repair brought the archive back. Port 22 SFTP worked before the new file and was closed after it.Also found by searching