Profile Picture

Spencer Burris

President/Lead Developer at the Quaternion Institute. Math student, programmer, and guitarist.

feed | tips | contact

How to Replace Sudo with Doas on Void Linux

Calendar icon January 27, 2021

Clock icon 1 min read

Folder icon #void #linux #software #packages #sudo #doas in tech


sudo is 40 years old and new CVEs are still being found, perhaps because it’s ~412k (mostly plugins and tooling, more like ~15k lines which is still a lot) lines of code to let users switch accounts for a single command.

The Four Steps

  1. Install the doas package: sudo xbps-install opendoas
  2. Create /etc/doas.conf and add permit your_username as root, this is the last time you’ll be using sudo.
  3. (optional) create a bash alias by adding alias sudo='doas' to ~/.bashrc then run source ~/.bashrc
  4. Remove the sudo package: sudo xbps-remove -F sudo or doas xbps-remove -F sudo if you didn’t add an alias.

Don’t Things Depend on Sudo?

Yes. The -F flag for xbps-remove is needed to force XBPS to ignore base-system’s dependency upon it. Everything I’ve seen will fallback to doas.