I see people talking about doas saying it’s just like sudo but with less features. I’m just wondering if there is any situation where you should use doas or if it’s just personal preference.

12 points

From what I hear, doas is more secure. I don’t think it matters though, as long as you keep your system updated. I use sudo still.

permalink
report
reply
3 points

How is it more secure?

permalink
report
parent
reply
-2 points
*

I think it’s because sudo only requires a password the first time on each shell.

permalink
report
parent
reply
8 points

sudo maintains ‘sudo state’ for 15 minutes. After that you need to enter the password again.

permalink
report
parent
reply
6 points

It’s entirely configurable but I think by default sudo will “cache” your authentication for a period of time so multiple commands in the same session only need the password entered once. You can even configure sudo to not need a password for certain commands (although obviously you need to be careful you’re not opening a hole in your security).

permalink
report
parent
reply
9 points

Afaik much smaller code base and as such easier to audit.

permalink
report
parent
reply
5 points

Thank you I think I will stick with sudo.

permalink
report
parent
reply
9 points

It’s really only more secure in the sense that in general more complicated programs have more things that can go wrong with them. Either bugs, or just user error.

That is a valid concern, and most people don’t need or use any of sudo’s extra features, so it’s completely reasonable to switch to doas because of that, but it’s not like there’s some glaring security flaw in sudo that most people really need to worry about. Especially if they’re not doing weird things in the config, which would mostly be the same people who could easily switch to doas anyway.

permalink
report
parent
reply
18 points

I use doas just because. It’s not necessary at all, but it can’t hurt either (I think). It might be a bit more secure (fewer features -> fewer code -> fewer bugs -> fewer vulnerabilities, need to give password more often). Kinda cool if you want more minimalism for fun (I replaced startx with sx…)

permalink
report
reply
2 points

You can change the config so you don’t need to give the password every time.

Adding the persist option only requires it once every few minutes within a terminal session.

https://manpages.debian.org/bullseye/doas/doas.conf.5.en.html#persist

permalink
report
parent
reply
1 point

Yeah. I like the config file being really easy to set up… permit persist user permit nopass user cmd poweroff permit otheruser cmd [whatever]

permalink
report
parent
reply
12 points

I just use doas because sudo has a bunch of features i don’t care about or use, and doas does everything i need while being significantly smaller.

permalink
report
reply
10 points

Does the size of a 6kb program really make that much of a difference?

Side note: If I’m reading this right (ignoring dependencies) sudo is 6kb while doas is 14kb.

permalink
report
parent
reply
14 points

6,054.0 kB, not 6 vs 14.0 kB

permalink
report
parent
reply
13 points

Ya know, I wish I could at least say something about being european and using commas instead of periods for decimal points, but I can’t even say that. Still 6MB fully installed is nothing these days.

permalink
report
parent
reply
10 points

Less lines of code needed means less chances of errors and potential vulnerabilities (if number and quality of eyeballs were the same)

permalink
report
parent
reply
3 points

Also only really applies if you are comparing programs in the same programming language as some programs have lines that are significantly more expressive than others. Conversely, some languages have constructs that are significantly more bug-prone than others (e.g. for loops with explicit integer indices instead of higher order functions like map or iterators to iterate over a collection).

permalink
report
parent
reply
16 points

Sudo is 6 megabytes

permalink
report
parent
reply
18 points

Damn, that’s like 4 floppies!

permalink
report
parent
reply
2 points

No, but it’s cleaner and designed for my usecase, and no real work to setup for me, all I had to do was add an alias

permalink
report
parent
reply
81 points
*

On the one hand, doas is simpler. Less code means less bugs, and lower chance someone manages to hack it and gain admin rights. On the other hand, sudo is more popular, and so has a lot more people double-checking its security. Ultimately, I don’t think it matters - when someone unauthorized gains admin rights, usually it’s not due to bug in sudo or doas, but other problems.

permalink
report
reply
15 points

Well said. Check your firewalls, check your ssh config, liberally use user repositories, and always tip the guard (donate to GNU)

permalink
report
parent
reply
12 points

When I thought about this question, I decided to ditch both sudo and doas entirely. I am certain this is an unpopular opinion, but I preferred setting up a granular permission + user system instead, and keeping root privileges for only a handful of use cases (primarily for system updates and package installations).

For anything else, a dedicated user is created, and given only permissions to do that exact thing only. Many of these users have no shell access at all, and for the ones that do, I use a password manager so I don’t have to memorize passwords for all of these users.

permalink
report
reply
23 points

Did you know that you can configure sudo to only grant access to specific programs?

permalink
report
parent
reply
6 points

Yes I did, and that’s a very good point. What sudo does not allow me to do is grant a user access to modify or read specific files or directories. I can get both that and access to executing specific programs using a users/groups permission system.

Another thing I don’t like about sudo is that you end up using the same password for everything, which is also the password for logging in. Putting higher privileges behind my same login password opens me to a single point of failure.

permalink
report
parent
reply
1 point

Why would a system update need privileges? What is the privileged action in pulling and applying updates your distro ships?

permalink
report
parent
reply
2 points

The short answer is that my distro did not let me do this easily. But that was for good reason.

A system update would require too many privileges that it would be almost indistinguishable from root.

Currently, every user I have is restricted in what files it has access to. A system update user would need access to so many files, including install locations of all binaries, and non-binary installation paths of all current and future programs I install (some package installs modify /var, many modify /etc, and so on).

This user will also have access to all these programs, down to system applications. It can trivially break a permission system I come up with.

It may be possible to restrict system updates to a user, but it would be such a powerful user that its not really worth it.

permalink
report
parent
reply
1 point

Does the user have that access? In my case with rpm-ostree they can just execute 2 commands rpm-ostree refresh-md (get updates) and rpm-ostree update. rpm-ostree rebase is used for system upgrades afaik, that one needs a password.

permalink
report
parent
reply
-1 points

What is the privileged action in pulling and applying updates your distro ships

Tell me again how you want to write system files with a non-admin account, and I’m going to show you my friend Lumpy, who will walk all over your machine so fucking fast. Fuck that, Lumpy’s a genius. One of his underlings (he manages now) will do it on a lunch break.

permalink
report
parent
reply
2 points

Uhm what?

permalink
report
parent
reply
4 points

I mean, that’s one of the things that definitely needs permissions, right? You’re overwriting system config and executables for all users on your system. Otherwise a malicious actor could just replace firewall configs, or embed malicious code into your executables. If not /bin and /etc what else should need privileges?

permalink
report
parent
reply
4 points

On a mutable distro maybe but also no. You need to update your system, always. The updates come from the distro, and you only invoke your privileged package manager to do these changes for you. Its not privileged.

If a malicious actor is able to replace package repos that your package manager uses, for example an infected server in the same network, this would be the only way to inject arbitrary stuff by using dnf update or rpm-ostree update.

Installing software and updating the already existing is very different.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 8.5K

    Monthly active users

  • 6.3K

    Posts

  • 173K

    Comments