Install Sudo
You will be able to install this from the ports collections if it is installed on your system. To do this, enter the following command:
# cd /usr/ports/security/sudo/
# make install clean
You can also install the sudo binary package using pkg:
# pkg install sudo
Add a Sudo User
First you need to create a user account to use with sudo
# adduser
Answer the questions from the suggested options to create a user. This tutorial will use user.example
Add User to Wheel Group
This group called “Wheel” limits the list of users who can use root
# pw group mod wheel -m user.example
Edit the sudoers file
First, you need to check the sudoers file with visudo extension
# visudo
Look for a wheelset. Remove comment if line is off. When you’re ready to save the file, it should look like this
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
Save and exit vi. ESC type, then : W Q, then ENTER
IMPORTANT! The visudo utility performs a syntax check before making changes to the file. The wrong sudoers file can break your system. Never edit /etc/sudoers directly. For example, if you make a mistake, you will see this when exiting visudo.
Leave A Comment?