Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run backup as restic user #104

Closed
ilyanep opened this issue Dec 10, 2022 · 2 comments
Closed

Run backup as restic user #104

ilyanep opened this issue Dec 10, 2022 · 2 comments

Comments

@ilyanep
Copy link

ilyanep commented Dec 10, 2022

Hello!

Following the example in the restic docs, I've set up restic to run as a separate user (rather than root). I believe I'll want to make use of the systemd timer implementation in this repo, but I'm not familiar enough with systemd timers to know for sure if my planned solution sounds like it'd work.

I think what I want to do is instead of installing the timer and service into /usr/lib/systemd/system like the Makefile does by default, I'll want to put it into ~restic/.config/systemd/user/ and enable lingering sessions for my restic user.

Does that sound about right? If I get this figured out, would it be valuable for me to contribute an option to make install that way back to this repo?

Thank you for putting this together! This is bound to really help me out with setting up my new backup system.

@erikw
Copy link
Owner

erikw commented Dec 10, 2022

Hey, fun that you explore different ways of running it. The best solution is (well can be) the tailored one

The scope of this project is not to cover all ways of doing it, as it makes it too complicated. But a summary of your findings would be nice to have documented here if someone is interested in a similar setup that you're doing :)

@erikw erikw closed this as completed May 17, 2023
@ilyanep
Copy link
Author

ilyanep commented Jun 7, 2023

Finally got around to doing this...

Not sure how I missed it but it turns out you can still put the service unit in the system directory and specify User=restic and Group=restic under the [Service] header and it just works:

[Unit]
Description=Run Restic backup

[Service]
Type=simple
ExecStart=/home/restic/restic-backup.sh 2>&1 | systemd-cat
WorkingDirectory=/home/restic
User=restic
Group=restic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants