Follow up commit from my last PR #31 that just got merged:
Maybe the error handling could be refined because if run as non-root, the first os.makedirs call would just raise an exception.
Gonna dwell on this for a bit to figure out what to do. Conceivably the snapborg binary could be setuid to root, or somebody might set up a special snapborg user that has write access to the /run/snapborg dir and so on. Actually I thought about doing that with the systemd units PR, but I couldn't find a way to reliably ensure/create a specific user in setup.py.
So in other words, I could add a check for os.geteuid() here, but the dir might still be writable despite running as a different user.
I added a commit which does the "ask for forgiveness not permission" thing for now though.
I see you merged the PR, so this will end up in a new PR :)
Follow up commit from my last PR #31 that just got merged:
Gonna dwell on this for a bit to figure out what to do. Conceivably the
snapborg
binary could be setuid to root, or somebody might set up a specialsnapborg
user that has write access to the/run/snapborg
dir and so on. Actually I thought about doing that with the systemd units PR, but I couldn't find a way to reliably ensure/create a specific user insetup.py
.So in other words, I could add a check for
os.geteuid()
here, but the dir might still be writable despite running as a different user.I added a commit which does the "ask for forgiveness not permission" thing for now though.
I see you merged the PR, so this will end up in a new PR :)