From my limited understanding, the doas
utility allows you to run any command as root but, by default, requires you to enter your own password instead of the root user's password.
How do I make it require root password instead?
This is not possible to achieve with doas
, by design. If you need to run a command as root using the root password, you may do so on a Linux system using the su
command like so:
su - -c "command"
(single dash is used to get the root environment when switching)
On a BSD system, you would instead use
su root -c "command"
(Note that the -c
option is passed to the root user's shell. It is not an option to su
in this case.)
doas
. Also, as mentioned in the comments in the question: A system should not have a root password
su
in this case is the better approach.
su
can be used with the root password to gain root access without even usingsudo
ordoas
is a big reason. This means that no manner of configuringsudo
ordoas
would disallow a user with the root password from gaining root access. Also, changing the root password could be done by anyone with access to it, instantly cutting off access from everyone else.