DOAS(1)

โœจ DOAS(1) โœจ โ€” General Commands Manual, bestie edition ๐Ÿ’…

okay so. this is the manual page for doas from the General Commands Manual section, and honestly? she's iconic. let's get into it ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

doas โ€” execute commands as another user

yes literally that's it, that's the whole vibe: you wanna run a command as somebody else, doas is your girl ๐Ÿ’–


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

doas [-Lns] [-C config] [-u user] command [args]

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

The doas utility executes the given command as another user. The command argument is mandatory unless -C, -L, or -s is specified. so like, you can't just vibe in there with no command, bestie, unless you brought one of those three flags with you โœจ

The user will be required to authenticate by entering their password, unless configured otherwise. yes, the password. the whole point. ๐Ÿ”

By default, a new environment is created. The variables HOME, LOGNAME, PATH, SHELL, and USER and the umask(2) are set to values appropriate for the target user. DOAS_USER is set to the name of the user executing doas. The variables DISPLAY and TERM are inherited from the current environment. This behavior may be modified by the config file. The working directory is not changed. periodt.

The options are as follows:

  • -C config โ€” Parse and check the configuration file config, then exit. If command is supplied, doas will also perform command matching. In the latter case either โ€˜permitโ€™, โ€˜permit nopassโ€™ or โ€˜denyโ€™ will be printed on standard output, depending on command matching results. No command is executed. it's giving "just checking, not doing" ๐Ÿ•ต๏ธโ™€๏ธ
  • -L โ€” Clear any persisted authentications from previous invocations, then immediately exit. No command is executed. bye bye leftover auth, so cleansing โœจ
  • -n โ€” Non interactive mode, fail if the matching rule doesn't have the nopass option. no password prompts here, it either works or it doesn't ๐Ÿ’€
  • -s โ€” Execute the shell from SHELL or /etc/passwd.
  • -u user โ€” Execute the command as user. The default is root. ๐Ÿ‘‘

๐Ÿ”ฅ EXIT STATUS ๐Ÿ”ฅ

The doas utility exits 0 on success, and >0 if an error occurs. It may fail for one of the following reasons:

  • The config file /etc/doas.conf could not be parsed.
  • The user attempted to run a command which is not permitted.
  • The password was incorrect.
  • The specified command was not found or is not executable.

so if it didn't work, it's one of those four, no cap ๐Ÿ˜ญ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

su(1), doas.conf(5)


๐Ÿฆ‹ HISTORY ๐Ÿฆ‹

The doas command first appeared in OpenBSD 5.8. vintage but still serving ๐Ÿ’…


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Ted Unangst <tedu@openbsd.org>


and that's the whole page bestie!! this one ships in the Debian build, dated January 16, 2021 โ€” so like, an older drop but the tea is still hot ๐Ÿ“ go run something as root (responsibly, or at least with a config file) mwah ๐Ÿ’–๐Ÿงšโ€โ™€๏ธ

๐Ÿ“ฆ where this page comes from