unoverse

Posted:

Replace sudo with doas on Void

About a year ago I swapped out sudo with OpenDoas which is a fork of BSDs doas.

Installing it is no more difficult than any other package.

xbps-install -S opendoas

Configure

The configuration file path is /etc/doas.conf and we do have to create the file. It is actually only one option that is required for it to work.

Since I’m the only one using my computers I can easily just permit my own user:

permit <user>

We can of course take advantage of the wheel group as well

permit :wheel

Uninstall sudo

For me, there is no reason to install doas if I’ll still have sudo installed. sudo is a part of the base-system in Void which means that it can’t just be uninstalled.

We need to add it to an ignore list for our package manager xbps to ignore it.

To ignore packages we need to create /etc/xbps.d/10-ignore.conf and add ignorepks=sudo to it.

Here is a oneliner to do the same:

echo "ignorepkg=sudo" | sudo tee -a /etc/xbps.d/10-ignore.conf

Now we can uninstall sudo as any other package.

Uninstall

Now we can remove sudo

xbps-remove -R sudo

Fun fact

The only thing I’ve ever needed from sudo is the posibility to run commands as the root user so when you check the configuration files of sudo and doas, and then look at the size of the installed package of each of them - it’s very obvious which to chose.. At least for me.

sudo installed size

installed_size:           4248KB

doas installed size

Size freed on disk:             51KB