this post was submitted on 13 Apr 2024
230 points (84.8% liked)

linuxmemes

21453 readers
948 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
  •  

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't fork-bomb your computer.

    founded 1 year ago
    MODERATORS
     

    Credit for the answer used in the right panel: https://serverfault.com/a/841150

    you are viewing a single comment's thread
    view the rest of the comments
    [–] sorrybookbroke 11 points 7 months ago* (last edited 7 months ago) (3 children)

    What if multiple users have to manage that service?

    Edit: nvrmnd, pretty sure the runnit solution won't allow this either, your answer is correct. What about while the service is already running? Wouldn't your solution require a restart?

    [–] [email protected] 12 points 7 months ago (1 children)

    If the service is already running it has to be stopped as a system service and run as a user service. In order to ensure that the service inherits all the correct permissions / acls / se linux policies the service needs to be launched from the limited permissions context.

    With the systemd approach you’re not just passing a control handle around. You’re ensuring the process is running under an appropriate security context.

    If you want to let multiple users manage the user systems service, I would probably go with sudo and systemd user files. You could create a group which has sudo access etc. The important idea is that an unprivileged user controls an unprivileged service.

    [–] [email protected] 3 points 7 months ago

    With the systemd approach

    What about this makes it "the systemd approach"? runit supports user services too. These are just two different tasks that are needed in different contexts. Sometimes what you need is to "pass a control handle around" to a privileged service. And sometimes you need to actually make a service unprivileged.

    [–] [email protected] 5 points 7 months ago* (last edited 7 months ago)

    pretty sure the runnit solution won’t allow this either

    I'm no expert, but I think you could make a special group, set the supervise directory to be owned by that group, and add all relevant users to that group? Either way, as I explained in a different reply, running the service as a user vs letting that user control a root service are completely different things, and one is not always a substitute for the other.

    [–] [email protected] 4 points 7 months ago* (last edited 7 months ago)

    A generic stack overflow answer:

    Do you REALLY need multiple users to manage that service? Maybe it's better to have multiple instances of that service and.... (This goes on and on)