News for hackers. Stuff that matters.
Re:Systemd Rolling Out "run0" As sudo Alternative by Karellen on Tuesday April 30, 2024 @12:30PM (#40212858)
> I also wasn't a fan of the tinting.

From the linked mastodon thread:

> For example, by default it will tint your terminal background in a reddish tone while you are operating with elevated privileges. That is supposed to act as a friendly reminder that you haven't given up the privileges yet, and marks the output of all commands that ran with privileges appropriately. (If you don't like this, you can easily turn it off via the --background= switch).

(emphasis mine)

Re:Systemd Rolling Out "run0" As sudo Alternative by gh02t on Tuesday April 30, 2024 @04:16PM (#40215782)
It was a bit unclear to me from the thread, is there a persistent configuration option for this? I like the idea of tinting the terminal, but I also want to be able to turn it off with a global config option rather than having to type out a --background flag every invocation.
Re:Systemd Rolling Out "run0" As sudo Alternative by zamadatix on Tuesday April 30, 2024 @04:20PM (#40215811)
Aliasing the command as the command + your default arguments is the easiest general solution to this kind of problem. I'm not sure if there is a "systemd way" to permanently set it though.
Re:Systemd Rolling Out "run0" As sudo Alternative by tolciho on Tuesday April 30, 2024 @06:54PM (#40217458)
I accidentally compile color support out of st, or set xterm*colorMode:false to avoid seeing the backside of a unicorn randomly rubbed all over the terminal, on account of git and other wares being bad at their inability to not spew color codes. A sensible default would be to set no colors, in the event that the colors are unreadable (due to colorblindness, etc) or distracting, but that ship sailed. Most of my vim config on RedHat linux was disabling wacky vendorisms, and back when I used linux I did have a "special terminal" for some NVIDIA installer that mandated colors to be usable. Maybe the terminal title was set to Fisher-Price, maybe not.
Re:Systemd Rolling Out "run0" As sudo Alternative by shrimp_emoji on Wednesday May 01, 2024 @09:16AM (#40222748)
Dang. I wish I had the autism to bristle at colors. Think about all the lost hours agonizing over themes! Not feeling the agonizing tension between the fact that cool-retro-term made your terminal into an awesome monochrome CRT but that it's monochrome green so your syntax highlighting is all messed up!

> back when I used linux

What do you use now? :0 BSD? Plan 9???

Re:Systemd Rolling Out "run0" As sudo Alternative by gh02t on Tuesday April 30, 2024 @04:36PM (#40216003)
True, I was thinking a simple environment variable or systemd configurable would be fine but I guess an alias is a good idea.
Re:Systemd Rolling Out "run0" As sudo Alternative by zamadatix on Tuesday April 30, 2024 @04:18PM (#40215796)
I think it's more that the default seems backwards than the lack of ability to change it.
Re:Systemd Rolling Out "run0" As sudo Alternative by dsr_ on Tuesday April 30, 2024 @04:40PM (#40216064)
It's three things:

* here is a feature which we are defaulting to on

* there's no persistent config for it

* we know better than you do about your preferences

Re:Systemd Rolling Out "run0" As sudo Alternative by zamadatix on Tuesday April 30, 2024 @06:03PM (#40216974)
"Defaulting to on" is just a symlink to an existing binary so that's not really much a problem.
Re:Systemd Rolling Out "run0" As sudo Alternative by gpm on Tuesday April 30, 2024 @08:38PM (#40218213)
A symlink to a binary that I'm going to pass a password to seems like a security bug waiting to happen (just in the manner that any complexity around privilege escalation is a bad idea).
Re:Systemd Rolling Out "run0" As sudo Alternative by deadbunny on Tuesday April 30, 2024 @06:16PM (#40217102)
I for one love to type out 13 extra characters to a 4 character command to disable dumb choices by the developer.

On a more serious note, I wonder what random ASCII escape sequences we can send.

Re:Systemd Rolling Out "run0" As sudo Alternative by BenjiWiebe on Wednesday May 01, 2024 @12:00AM (#40219371)
'alias' is your friend.
Re:Systemd Rolling Out "run0" As sudo Alternative by deadbunny on Wednesday May 01, 2024 @08:26AM (#40222214)
I shouldn't need to alias behaviour that violates the principle of least surprise on every single machine I need to run elevated commands on.
Re:Systemd Rolling Out "run0" As sudo Alternative by shrimp_emoji on Wednesday May 01, 2024 @09:11AM (#40222685)
Eh.

`alias grep='grep --color=auto'`

`alias ls='ls --color=auto'`

It's canon.

Re:Systemd Rolling Out "run0" As sudo Alternative by Karellen on Wednesday May 01, 2024 @06:16AM (#40221421)
> I for one love to type out 13 extra characters

FWIW, systemd is normally pretty good at providing autocomplete suggestions, so even if you don't want to set up an alias you'll probably just have to type `--b<TAB> ` to set it.

> I wonder what random ASCII escape sequences we can send.

According to the man page source[0]:

> The color specified should be an ANSI X3.64 SGR background color, i.e. strings such as `40`, `41`, …, `47`, `48;2;…`, `48;5;…`

and a link to the relevant Wikipedia page[1]. Given systemd's generally decent track record wrt defects and security issues, and the simplicity of valid colour values, I expect there's a fairly robust parameter verifier in there.

In fact, given the focus on starting the elevated command in a highly controlled environment, I'd expect the colour codes to be output to the originating terminal, not forwarded to the secure pty. That way, the only thing malformed escapes can affect is your own process, which you already have full control over anyway.

(Happy to be shown if that's a mistaken expectation though.)

[0] https://github.com/systemd/systemd/blob/main/man/run0.xml

[1] https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_G...