What is the fundamental difference between sudo and doas ?

12 hours ago by TheViking to c/nostupidquestions

BananaTrifleViolin 9 points 8 hours ago
  • Su = Switch User / Substitute User; it allows you to run a full shell as another user. It can be any user, but if you don't specify then it'll open a shell as the root user with its elevated privileges. It allows you to do everything the root user can while that shell is still open, until you exit.

  • Sudo = SuperUser Do; it allows you to run one command with elevated privileges as the root user. Once it's done the command it usually then ends. You can actually also launch a full interactive shell with sudo -i but it's not really used much as it's easier to just type su and use that tool instead.

  • Doas = Dedicated Openbsd Application Subexecutor (seriously). It's an alternative to Sudo that originated in Openbsd that also allows users to run a command with elevated privileges as the root user. Doas can also be used to open a full shell like Su (e.g. doas -su Username). Its code is smaller and tighter, and is seen as more secure than Sudo. It also has much more straight forward configuration. It's newer than Sudo, so although Doas is in theory better, Sudo is the default widely used tool across the vast majority of Linux.

path: 0 24387757, hotness: undefined, score: 9, children: 4
corsicanguppy 4 points 4 hours ago

Dedicated Openbsd Application Subexecutor

That's got to be a convoluted Backronym.

path: 0 24387757 24390551, hotness: undefined, score: 4, children: 0
Goun 3 points 3 hours ago

You can actually also launch a full interactive shell with sudo -i but it's not really used much as it's easier to just type su and use that tool instead.

su asks for the target user password, while sudo asks for your password, tho, if I'm not mistaken

path: 0 24387757 24391281, hotness: undefined, score: 3, children: 0
TheViking 1 point 8 hours ago

Sudo is widely used, while Doas is in theory better ??

path: 0 24387757 24387916, hotness: undefined, score: 1, children: 1
BananaTrifleViolin 6 points 8 hours ago

Yeah, Sudo has been around for ages and is in pretty much every distro. So Doas just hasn't really taken off due to inertia. You can install it yourself in many distros, but people tend to default to what they know. I'm not sure if any linux distros default to it. Also tutorials all over the internet use "sudo" so it kinda embeds it more as THE tool.

It's similar with a lot of the core GNU utilities. For example "ls" lists directories and it's everywhere, but there are actually better written newer alternatives. They just aren't as widespread because people tend to use the GNU utilities together. I personally like eza for example.

EDIT: Just to be clear; Sudo is NOT one of the GNU Core Utilities, but Sudo originated in 1980 according to wikipedia. Doas was released in 2015.

path: 0 24387757 24387916 24387994, hotness: undefined, score: 6, children: 0
Forester 6 points 11 hours ago

Sudo runs a temp shell as root. Doas runs the temp shell with whatever user you specified defaults to root w no arguments. Personally I just su to the user then run the command as the user natively in the users shell, makes it way easier to see what you did in the history and logs

path: 0 24385018, hotness: undefined, score: 6, children: 10
TheViking 4 points 11 hours ago

Could you please make that eli5 ??

path: 0 24385018 24385240, hotness: undefined, score: 4, children: 7
SlicedPotato 5 points 11 hours ago

Sudo: Always uses the root user to get access to run a command, no matter which user you want to run the command as. Doas: Uses the user you want to run the command as to actually get access to run the command.

path: 0 24385018 24385240 24385439, hotness: undefined, score: 5, children: 4
Shimitar 7 points 10 hours ago

Sudo -u otheruser do still go trough root?

path: 0 24385018 24385240 24385439 24385874, hotness: undefined, score: 7, children: 3
SlicedPotato 2 points 10 hours ago

Yes.

path: 0 24385018 24385240 24385439 24385874 24385918, hotness: undefined, score: 2, children: 0
corsicanguppy 1 point 4 hours ago

Nah. The guy's either confusing sudo -u and sudo su - or confusing "has suid so it can switch users" with "always goes through root". Because it doesn't "go through" root like sudo su does.

path: 0 24385018 24385240 24385439 24385874 24390596, hotness: undefined, score: 1, children: 1
Forester 2 points 7 hours ago

Sudo find -f

Super user do command find and look for all files in the current directory

Makes a tempory separate session (shell) to run command as root user from the current working directory

Doas find -f

Super user do command find and look for all files in the current directory

Makes a tempory separate session (shell) to run command as root user from the current working directory

Doas bob find -f

Do as Bob look for all files that can be accessed

Makes a tempory separate session (shell) to run command as bobs user from the current working directory, will show any files that bobs group or user owns.

path: 0 24385018 24385240 24388444, hotness: undefined, score: 2, children: 0
one_old_coder 1 point 43 minutes ago

Ask ChatGPT instead if you don't want to have a conversation.

path: 0 24385018 24385240 24392349, hotness: undefined, score: 1, children: 0
corsicanguppy 1 point 4 hours ago

Sudo runs a temp shell as root.

Weird. I sense it can run subshells as other users too.

path: 0 24385018 24390572, hotness: undefined, score: 1, children: 1
Forester 1 point 29 minutes ago

I may be using the wrong terminology. Put it spawns the pid as root

path: 0 24385018 24390572 24392483, hotness: undefined, score: 1, children: 0
AGuyAcrossTheInternet 1 point 11 hours ago
path: 0 24385063, hotness: undefined, score: 1, children: 0
ryannathans 1 point 7 hours ago path: 0 24389139, hotness: undefined, score: 1, children: 0
nostupidquestions
nostupidquestions

@lemmy.world

login for more options
48587
6376
7418

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.

Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here. This includes using AI responses and summaries.

Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

go to feed...