16
submitted 2 years ago* (last edited 2 years ago) by onlinepersona@programming.dev to c/linux@programming.dev

I've inherited a systemd service and it uses BindReadOnlyPaths to make certain paths available to the service (doc)

A bind mount makes a particular file or directory available at an additional place in the unit's view of the file system. Any bind mounts created with this option are specific to the unit, and are not visible in the host's mount table.

The service is running using a specific user and I would like the user to access those read-only paths outside of the service. Is there an possibility within systemd that would allow me to do that?

Edit: solved it with a systemd bind mount

top 3 comments
sorted by: hot top new old
[-] nesc@lemmy.cafe 1 points 2 years ago

What do you meam by outside of service, but within systemd?

[-] onlinepersona@programming.dev 1 points 2 years ago

As in the solution should use systemd i.e no "just sudo mount --bind -o ro /src /dst bro". Then when I sudo -u $serviceUser cat $mountPath, it should output the contents of the file instead of just nothing.

Anti Commercial-AI license

[-] nesc@lemmy.cafe 1 points 2 years ago* (last edited 2 years ago)

Well just create another service with mounted paths and run shell script inside it or use systemd run --property ...?

this post was submitted on 01 Feb 2025
16 points (100.0% liked)

Linux

15202 readers
444 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 3 years ago
MODERATORS