Configure OpenBSD's doas Root Access

It is not a good idea to stay logged in as a superuser in a system. Also, having to su everytime to run some command as root, and accomplish a super task, isn’t tough. So, OpenBSD gives us the doas command facility. A program that acts like the famous sudo command, you may have already heard about.

To configure it, do the next steps as root!

Execute the command bellow, but note that you must change youruser with the login intended to have doas configured for:

# echo "permit nopass youruser as root" >> /etc/doas.conf

Logout, login, with the user you just set it up, and you are ready to use it!

For example, if you want to edit a file owned by root:

$ doas vi /the-file-owned-by-root