borg icon indicating copy to clipboard operation
borg copied to clipboard

borgfs mount via /etc/fstab - how to give the passphrase?

Open ThomasWaldmann opened this issue 2 years ago • 1 comments

(from IRC, iirc)

ThomasWaldmann avatar Jun 26 '22 20:06 ThomasWaldmann

Not a direct solution for the issue, but I had the same problem and found a workaround that works for me:

I created a systemd mount unit in /etc/systemd/system/. The filename must match the mount path, best generate it with systemd-escape --suffix mount --path <full path>.

[Mount]
Type=fuse.borgfs
What=<user>@<host>:<path to backup>
Where=<local mount path>
Options=noauto,user,uid=<my uid>,gid=<my gid>,allow_other
Environment=BORG_PASSCOMMAND='cat <path to secret>' BORG_RSH='ssh -i <path to ssh key>'

With that, I was able to mount the backup without giving the passphrase: sudo systemctl start <mount unit>. This still requires a sudo password. But by adding a systemd automount unit, I just need to access the mountpoint!

Use the same base name in /etc/systemd/system/, but with .automount extension.

[Automount]
Where=<local mount path>
TimeoutIdleSec=120

Needs to be activated with systemctl daemon-reload, systemd start <automount unit>.

JochenLutz avatar Apr 19 '24 18:04 JochenLutz