-
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.
post
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
Could you please make that eli5 ??
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.
Sudo -u otheruser do still go trough root?
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.
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.
Your question is perfectly valid btw. The answer you wanted as an eli5 was very poorly explained, using a lot of jargon and bad phrasing and formatting and typos here and there.
I understand perfectly why you'd need a breakdown of what they said if you are new to this. Dont listen to people asking you to talk to an AI chat bot. Fuck AI and fuck rude people like that.
Welcome to the Linux community! 🤗
Ask ChatGPT instead if you don't want to have a conversation.
Sudo runs a temp shell as root.
Weird. I sense it can run subshells as other users too.
sudo and doas do basically the same thing. The OpenBSD people wrote doas because sudo is super overcomplicated and they wanted something smaller and simpler (they do that a lot!). In typical OpenBSD fashion it's way less of a pain to configure. But like, sudo is also fine.
-- Frost
Well answered in your duplicate post https://nord.pub/c/linuxquestions/p/267003/what-s-the-fundamental-difference-between-sudo-and-doas
top 23 comments