doas is a sudo alternative ported from openbsd
install doas
create the doas config file
add the following code to the doas.conf file
make sure your user is in the wheel group
The syntax is:
instead of allowing members of the wheel group to execute commands as root without a password which may be a security issue,you can just allow your user to execute commands as root without a password,
by replacing username with your username in the code below
to switch to root using doas
read the man page for more details
enable auto completion for doas and bash
edit your ~/.bashrc
add the following code to your ~/.bashrc to enable doas bash auto completion
source your ~/.bashrc
install doas
Bash:
# pkg install doas
create the doas config file
Bash:
# vi /usr/local/etc/doas.conf
add the following code to the doas.conf file
Bash:
permit nopass keepenv :wheel
permit nopass keepenv root as root
make sure your user is in the wheel group
The syntax is:
Bash:
pw group mod {GROUP-NAME-HERE} -m {USERNAME-HERE}
pw group mod wheel -m username
instead of allowing members of the wheel group to execute commands as root without a password which may be a security issue,you can just allow your user to execute commands as root without a password,
by replacing username with your username in the code below
Bash:
permit nopass keepenv :username
permit nopass keepenv root as root
to switch to root using doas
Bash:
doas su
read the man page for more details
enable auto completion for doas and bash
edit your ~/.bashrc
Bash:
vi ~/.bashrc
add the following code to your ~/.bashrc to enable doas bash auto completion
Bash:
complete -cf doas
source your ~/.bashrc
Bash:
. ~/.bashrc
Last edited: