Setting up a non-root user with sudo privileges is crucial for maintaining the security and manageability of your system. This tutorial will guide on how to add a non-root sudo user in FreeBSD 14.

Log In as Root

Start by logging into your FreeBSD server as the root user. If you’re not already logged in as root, you can switch to the root user by entering su - and providing the root password.

Add a New User

Use the adduser command to create a new user. You will be asked to fill in some details like username, password, and whether to create a home directory.

Install Sudo

Ensure sudo is installed with the following commands:

pkg update && pkg install sudo

Grant Sudo Privileges

Edit the sudoers file by running visudo to safely modify it with syntax checking:


Add the following line to give your new user sudo access:

username ALL=(ALL) ALL

Replace username with your new user’s actual username. In this tutorial, the new username creates was johndoe. Thus, the line added will be:

johndoe ALL=(ALL) ALL

Test Sudo Access

su - username
sudo pkg update

Replace username with your new user’s actual username.

Leave a Reply

Your email address will not be published. Required fields are marked *