Meta(
    title: "Re: Feature Poor sudo Replacement",
    summary: Some("I explain in more detail why the size and complexity of sudo is bad - for the average user"),
    published: Some(Time(
        year: 2023,
        month: 3,
        day: 12,
        hour: 23,
        minute: 6,
        second: 37,
    )),
    tags: [
        "software" ,"complexity", "linux",
    ],
)
---
> doas requires wrapper scripts to run programs limited to particular arguments that sudo could do from its config file. The complexity must go somewhere, and may need to be invented at multiple sites.

=> gemini://thrig.me/blog/2023/03/12/feature-poor-sudo-replacement.gmi

I'm aware of doas, and this reply in general brings up some good points. But it seems obvious that I didn't frame my thoughts completely.

## Who is the "average" Linux user?
Ordinarily I'd say Unix, not Linux. This time I said Linux intentionally, because if you're using another form of Unix then you are already not the average user.

When I first started using Linux very few distributions shipped with sudo. If you needed to do sysadmin type things then you used su in a terminal and became root until you were done. The thing is, people are lazy, and a lot of people would just leave that root terminal running because typing a password is so much work.

The first distro I personally saw that provided sudo by default was Ubuntu. They also discouraged the use of su to have a long running terminal by providing a default configuration that did not add your own personal user to the `wheel` group and disallowed logging in as root graphically. Now, they may very well not have been the first to go down this route. They were the first that I personally noticed. Over time, most Linux distros have followed a similar path.

The average Linux user is definitely not a sysadmin. The average user is running Linux on their own personal computer where their user login is the only user login (other than root and system users). Their use of sudo is confined mostly (if not completely) to installing updates and using the package manager. They might occasionally need to edit a file in /etc. Nobody could come up with accurate numbers here, but I would venture to guess that occasionally running a command as root on their own system is the use case for which sudo is used 99% of the time. If you fall into the 1% that needs to edit /etc/sudoers (beyond uncommenting the line which allows members of `wheel` to run commands as root) then I guess sudo is the correct tool.

> A lot of those five percents were added with the best intentions. The screen saver password check that uses the accessibility framework, which makes the system very accessible, for example. And suddenly you have 100,000 lines of code.

I hope that nobody reading this post is offended by my saying this, but that is a great example of terrible design. If the software stack is designed in such a way that the screenlocker has to shell out to sudo to unlock the screen, this is a house of cards.

## That part where I make another folksy metaphor
I'm going to resist the urge to make another car metaphor for this and instead talk about power tools.

A made up town in a heavily forested area has noticed that they spend a huge amount of the yearly budget on trimming trees away from power lines. As a short sighted stopgap, an ordinance is passed requiring all single family dwellings sold in their town to be sold with a chainsaw, encouraging homeowners to take a more active role in maintenance.

A certain number of homeowners will dilligently read the chainsaw manual that they found tucked in a drawer, run the correct oil to lubricate the chain, run the correct mix of gas and oil, keep the chainsaw in tune and trim their trees just like the town wanted. This is the 1%. The majority of homeowners will enthusiastically try out the chainsaw and grow tired of it once the novelty wears off. By the following season the saw will no longer start. A fair percentage will literally have a beer in one hand and the running saw in the other while climbing on top of their pickup truck because ladders are expensive. Shirtless. While listening to Lynard Skynard. There will be a certain percentage of limb removal that is not of the cellulose variety.

Summing up, I totally get that sometimes commplexity evolves for a reason and that those who came before were likely well meaning. That said, I still think that a 100,000 LOC command line utility is vast overkill for the use that it's being primarily put to. Linux distributions added it back in the day NOT with sysadmins in mind, but with the shirtless guy eating cheetos playing adventure in a root terminal. The tool is way overkill for it's usual problem space. If your use case is more like that of a sysadmin who needs granular control over what users are allowed to do on a company owned system, that's not what I'm talking about.
