229

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

top 50 comments
sorted by: hot top controversial new old
[-] mholiv@lemmy.world 86 points 1 year ago

When you hate something so much you have to find weird corner cases to support your views. Even then the way described isn’t how someone who knows that they are doing would do.

The best way for an unprivileged user to manage a service is for that user to run it. That way you inherit the correct permissions / acls / selinux contexts.

The command to do so is:

systemctl --user start the_service.service

[-] sorrybookbroke@sh.itjust.works 11 points 1 year ago* (last edited 1 year ago)

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?

[-] mholiv@lemmy.world 12 points 1 year ago

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.

[-] renzev@lemmy.world 3 points 1 year 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.

[-] renzev@lemmy.world 5 points 1 year ago* (last edited 1 year 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.

[-] MashedTech@lemmy.world 4 points 1 year ago* (last edited 1 year 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)

load more comments (10 replies)
[-] Vilian@lemmy.ca 44 points 1 year ago

he's trying to run the service as a user without run sudo, good luck trying that with runit

[-] mexicancartel@lemmy.dbzer0.com 2 points 1 year ago
[-] Vilian@lemmy.ca 2 points 1 year ago

he don't want to log as root, so a root shell isn't what he want

[-] bjoern_tantau@swg-empire.de 41 points 1 year ago* (last edited 1 year ago)

And people who like systemd just thought of the first part of the answer which is exactly what the asker ended up doing.

Which is basically the same as the runit way while putting everything in the user's directory.

[-] possiblylinux127@lemmy.zip 28 points 1 year ago
load more comments (5 replies)
[-] anyhow2503@lemmy.world 24 points 1 year ago

Big news (from 2017): debian held back software features because someone doesn't like the new way of doing things. Let's blame systemd for this unprecedented case.

What's wrong with giving access to the specific sudo command, as suggested in the other answers?

[-] traches@sh.itjust.works 22 points 1 year ago

How is chown-R someuser different from systemctl—user?

[-] brian@programming.dev 24 points 1 year ago

one is giving the permission to manage the system service to a specific user, the other is running the service as the current user so they have permission to manage it by default

[-] Sanctus@lemmy.world 12 points 1 year ago

I'm gonna fuck up my desktop now breaking away from systemd

[-] Darorad@lemmy.world 7 points 1 year ago

Yeah, I would switch off, but it just doesn't seem worth the effort for something I rarely interact with.

If it’s providing you the functionality you want using an overhead you’re fine with, there’s no reason to change it.

[-] duviobaz@lemmy.blahaj.zone 11 points 1 year ago

I'm using Debian without ever having been involved in the init-wars. What's wrong with Systemd and why should i not use it?

[-] anarkatten@lemmy.ml 4 points 1 year ago

I'd like to know too, a ELI5 version if possible. Somethingsomething monolithic, but what does that actually mean for me as an end user?

[-] phoenixz@lemmy.ca 9 points 1 year ago

In my personal opinion, correct me if I'm wrong:

Systemd was created to replace the init system, then through extreme scope creep took over way more than wanted and needed, the main developer was "problematic" to say it politically correct, and in practice it has over complicated many super easy tasks to the point that I hate it. Other init systems were intuitive, systemd is all but.

Few weeks ago I setup a systemd server ssh server. Changing the port would be 5 seconds in changing a line in the sshd config, but now with the new and improved systemd I need to follow some nightmare documentation into creating systemd files in unrelated places and reload configs or something and I'm done with it

[-] renzev@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

If you've never had a reason to not use it, then it's fine to continue using it. Systemd has been shown to be more or less stable, fast, and secure. The reason I don't like it is because it makes simple things really complicated. Some examples:

  • The meme
  • u/phoenixz@lemmy.ca example with sshd
  • Distros that use systemd init also seems to prefer using other systemd components as well. So you can get caught in weird situations where one task is spread across two different systems (e.g. systemd timers vs cron, systemd-elogind vs acpid)

If none of these sound familiar, then switching to a non-systemd distro likely won't make your life easier. But if you do, then it might be worth considering.

[-] NeatNit@discuss.tchncs.de 6 points 1 year ago* (last edited 1 year ago)

I'm out of the loop. The answer that references "one person's personal opinion" is from 2017, and the context it links to is from 2016. Surely things have changed since then, right?

.. Right?

(I'm genuinely asking, I've got no idea)

Edit: I just checked on Linux Mint 21.3. It's still on the same version as back then, 0.105. Well, Debian is nothing if not sable!

[-] ozymandias117@lemmy.world 3 points 1 year ago

Bookworm looks to be on version 122, so as downstream distros update to newer Debian versions, it should be updated now

load more comments (4 replies)
load more comments (1 replies)
[-] WalnutLum@lemmy.ml 6 points 1 year ago

And how do you do this in gnu shepherd?

You don't!

[-] lightnegative@lemmy.world 5 points 1 year ago

Is it r-unit, or run-it?

I've read it as r-unit for so long and now I've only just realised that run-it makes far more sense

[-] nilclass@discuss.tchncs.de 3 points 1 year ago

Someone is asking the important questions

[-] renzev@lemmy.world 3 points 1 year ago

lol I've been pronouncing nginx as "enn-jinx" for so long before I learned that it was "engine-ex".

[-] pipows@lemmy.today 3 points 1 year ago

I'm not yet convinced that "violating the unix philosophy" is a bad thing. I'm not saying that it's not, I don't have a defined opinion about this yet

[-] redcalcium@lemmy.institute 2 points 1 year ago

Which one looks more enterprisey and ensure your job security?

load more comments (1 replies)
[-] mojo_raisin@lemmy.world 2 points 1 year ago

DJB is a genius

[-] hector@sh.itjust.works 2 points 1 year ago

Guys I only used SystemD and I didn’t know you could use anything else lol stop hating I never had any problems!

load more comments
view more: next ›
this post was submitted on 13 Apr 2024
229 points (84.6% liked)

linuxmemes

24739 readers
1617 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 users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • 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.
  • 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, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  •  

    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 remove France.

    founded 2 years ago
    MODERATORS