3 ms·
Great tip. I would also couple it with the —-user flag so the service runs as your user. Stuff like this shouldn’t have root permissions anyway.
by fellerts 3y ago
Great tip. I would also couple it with the —-user flag so the service runs as your user. Stuff like this shouldn’t have root permissions anyway.
- shardulaeer 3y agoThat's a good thought. `sudo` is needed for writing to `/usr/`. The service being set up does not have root access. The value of `User=` is $SUDO_USER (hp- my regular non privileged user who initiatiated sudo) instead of $USER (root). https://github.com/servicer-labs/servicer/blob/762801e3c07b1d1e8bf680efff9ab668afcf909c/src/handlers/handle_create_service.rs#L162 https://github.com/servicer-labs/servicer/blob/762801e3c07b1...
- markstos 3y agoTypically the `User=` directive is used to specify what the user the service runs in. There is still a benefit to requiring root to create the service file though: If the service is compromised when it's running as `User=`, it can't modify the systemd service file itself, which is owned by root.