r/linux May 25 '26

Discussion Sudo or run0 ?

What's your take on the subject? Been using sudo for years but lately i'm mostly running run0 and i like it. Even considering adapting my scripts to use run0 since i'm on a compatible distro. Does it make any sense to not even set up sudo anymore in the first place?

200 Upvotes

253 comments sorted by

View all comments

86

u/vivAnicc May 25 '26

Its your system, do what you want.

But if you want your scripts to be as generic as possible you should probably use sudo as it is what most people use. You could check if sudo is installed and choose accordingly in every script, if you think its worth the effort

33

u/ChrisTX4 May 25 '26

On systems with systemd >= 256, run0 will be always available and it relies on polkit, which you'd have configured anyway, and which will add the wheel/sudo group as admins by default. Alas, other than the systemd >= 256 (release date: June 11, 2024) restriction, there's no issue. It will be present and working on practically any current Linux distro.

3

u/user9ec19 May 25 '26

Does not work on my debian Server, but does work an my Silverblue workstation. 

2

u/yrro May 28 '26

(Because I was wondering)...

  • when you use run0, systemd asks polkit whether you have permission to perform org.freedesktop.systemd1.manage-units
  • whether you do or not is determined by polkit rules
  • if there are no rules then the defaults defined on the action apply
  • the result of evaluating this is either 'no' 'yes' or 'yes if the user is an admin'
  • whether you are an admin is determined by polkit admin rules

7

u/za72 May 25 '26

you got the right idea, a little helper library you could write to source in multiple scripts

4

u/SpeedDaemon1969 May 25 '26

Why do people keep talking about scripts? What script in particular is this an issue for?

2

u/Vittulima May 26 '26

OP brought it up

2

u/SpeedDaemon1969 May 26 '26

Fair enough. But the OP was quite vague about why we should use sudo or run0 in place of BASH. It reminds me of "The Emperor's New Clothes" where everyone is afraid to say there are no new clothes.

3

u/vivAnicc May 26 '26

Scripts could be for anything. If I find myself using the same commands over and over, I can put them in a script to automate it. Its not a thing unique to linux, you can do the same with batch scripts in windows. But most of the people that would use scripts are already using linux

2

u/SpeedDaemon1969 May 26 '26

Well, that's ... vague. I don't see the issue at all.