SUDO(1)

πŸ“¦
version 0.2.0 Β· 4 versions
, in alpine 3.24

πŸ’… SUDO(1) β€” the group chat version πŸŽ€

okay so bestie, you're reading the SUDO(1) page from section 1 of the manual (general commands, iykyk), and honestly? this one's a whole personality. it's sudo, but make it doas. let's get into it ✨


✨ NAME ✨

sudo β€” execute a command as another user using doas. literally that's it, that's the vibe πŸ¦‹


🌸 SYNOPSIS 🌸

sudo (-i | -s) [-k] [-n] [-u <user>] [<command> [--] [<args>...]]
sudo [-ikns] [-u <user>] <command> [--] [<args>...]
sudo -k
sudo [-h]

look at all those little bracket combos, she's giving options πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, important lore first: this is NOT the original sudo(8). it's a shim for the sudo command that leans on doas(1) to do the actual work. no cap.

so what does it support? only a subset of the sudo(8) options (both short and long variants) that have an equivalent in doas(1), plus the extra-special options -i (--login) and -k (--reset-timestamp). that's the whole menu, nothing more πŸ™ˆ

if you want the real tea, go read doas(1) and sudo(8). they're the source material. πŸ“š


πŸ’– OPTIONS πŸ’–

  • -i, --login β€” runs the shell listed in the target user's password database entry as a login shell. translation: login-specific resource files like .profile, .bash_profile or .login get read by the shell. if you pass a command, it gets handed to the shell for execution via the shell's -c option. if you pass no command, you get an interactive shell. and this shim tries to change into that user's home directory right after running the shell 🏠
  • -k, --reset-timestamp β€” invalidates the user's cached credentials by running doas(1) with the -L option. used with no command, it clears the cached credentials and just peaces out ✌️
⚠️ WARNING: when you use this with a command, it's only an approximation, bestie. unlike sudo(8), OpenDoas can't ignore the cached credential for a single invocation while also preventing the timestamp from being refreshed. so this shim calls doas -L before and after the command instead β€” which is not atomic and may leave or expose a refreshed timestamp if it gets interrupted or used concurrently! πŸ’€ seriously, read that twice.
  • -n, --non-interactive β€” non-interactive mode: it fails if the matching rule doesn't have the nopass option. no prompts, no small talk, just vibes and consequences 😀
  • -s, --shell β€” runs the shell specified by the SHELL environment variable if it's set, or else the shell specified by the invoking user's password database entry. if you pass a command, it goes to the shell for execution via the shell's -c option. if you pass no command, you get an interactive shell 🐚 heads up though: most shells behave differently when a command is specified compared to an interactive session β€” so consult the shell's manual for the deets, i don't make the rules πŸ“–
  • -u <user>, --user <user> β€” run the command as a user other than the default target user (which is usually root). the user can be either a user name or a numeric user-ID (UID). and here's the glow-up: unlike in the original sudo(8), numeric UIDs don't have to be prefixed with the # character, and only UIDs listed in the password database are allowed πŸ‘‘
  • -h, --help β€” prints the help message and exits. the "i'm lost" button 🫢

πŸŽ€ FILES πŸŽ€

refer to doas(1). that's the whole section, she's short and mysterious πŸ’œ


🌈 ENVIRONMENT 🌈

this shim sets the following environment variables for compatibility with sudo(8). BUT β€” and this is the catch β€” they must be explicitly allowed in doas.conf(5) (using setenv or keepenv) to actually be exported into the created environment. no permission, no vibes 🚫

  • SUDO_GID β€” set to the group-ID of the user who invoked sudo.
  • SUDO_UID β€” set to the user-ID of the user who invoked sudo.
  • SUDO_USER β€” set to the login name of the user who invoked sudo.

refer to doas(1) for more info, as always 🧚


⭐ EXIT CODES ⭐

refer to doas(1). yep, that's it, go look πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

Jakub Jirutka β€” the icon, the legend, the main character who wrote this 🫑


πŸ“ REPORTING BUGS πŸ“

found a bug? report it to the project's issue tracker at https://github.com/jirutka/doas-sudo-shim/issues. don't just suffer in silence, bestie 😭


πŸ”₯ SEE ALSO πŸ”₯

doas(1) doas.conf(5) sudo(8)

the whole friend group, all here πŸ’–


and that's the tea β˜• β€” this page came from the 2026-06-09 build (that's the date, ✨ iconic ✨), so go forth and sudo responsibly, bestie. mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from