this post was submitted on 19 Jun 2026
53 points (94.9% liked)

Selfhosted

60074 readers
630 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam.

  3. Posts here are to be centered around self-hosting. Please ensure it is clear in your post how it relates to self-hosting.

  4. Don't duplicate the full text of your blog or git here. Just post the link for folks to click.

  5. Submission headline should match the article title.

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

Let's say you have access to a remote machine and use it to copy backups occasionally, eg with rsync. Your local machine has credentials stored that allow write access on the remote machine, however if the local account was compromised that could also allow access to the remote machine and the data stored there.

How can you grant access to an account to write remotely, but also protect the data from this account? One possibility could be to change the permissions on the data after it is copied to prevent deletion/interference, although I'm just making this up. Is there a standard practise for this?

you are viewing a single comment's thread
view the rest of the comments
[–] HelloRoot@lemy.lol 6 points 3 days ago* (last edited 3 days ago) (1 children)

I think you could do it somewhat like hetzner does for their storage boxes. You get an account that has read and write access to a directory and nothing outside. The accound can only run a limited set of commands, like ls, cat, nano, rsync etc. but has no access to commands that modify the filesystem.

Then you can use a copy on write fs like btrfs and make scheduled staggered snapshots.

I usually do 1x per year, 1x per month of current year, 4 per week of current montg, 7 per day in current week.

I have no clue what they use to limit the user accounts like that btw. but maybe that gives you a new jump off point for further research.

[–] groet@feddit.org 1 points 1 day ago (1 children)

Nano and rsync are 100% designed to modify the filesystem. But yes the idea is correct.

Same with got over ssh, you restrict the connection to the got shell that can only do the things you want.

[–] HelloRoot@lemy.lol 1 points 1 day ago (1 children)

Are they? I thought they only write/modify/delete data to the fs, not change the fs itself.

[–] groet@feddit.org 1 points 1 day ago (1 children)

Yeah precice phrasing ia hard sometime. I was refering to delete/modify of files as "changes to the fs". Not sure how changing the actuall fs would be relevant to the backup question.

OP needs a restricted shell that can take backup data and write it to disk but not be able to modify anything that is already there. Nano and rsync can both do that.

[–] HelloRoot@lemy.lol 1 points 22 hours ago* (last edited 22 hours ago)

OP asked:

How can you grant access to an account to write remotely, but also protect the data from this account?

So I was thinking that the account should not be able to delete the filesystem in an unrecoverable way. Like overriding the current fs with random data or an encrypted fs and filling it etc.

Like I said on a Hetzner storage box, multiple users get access to the same system, but each one only has file editing commands, not fs editing and they can only access their assigned directory. So if the system does scheduled snapshots (outside of that user's scope of access) there is no way for a user to delete the files beyond recoverability. (no matter if their own files or other users files).

The user can still delete their own data. But because the fs is cow with snapshots (like btrfs) and they can not touch that, the data can be recovered easily.