Computerglitch

An ongoing adventure

Configuring Sudo on FreeBSD

Setting up sudo on FreeBSD is simple. First install sudo using ports:

# cd /usr/ports/security/sudo
# make install clean

Once sudo is installed you need to specify what user will be allowed to run root commands. In this case I wanted to allow the user fred to mount remote windows shares on the FreeBSD box:

# visudo

Add the following at the bottom of the sudoers file, substituting fred with a username on your system:

fred ALL=/usr/sbin/mount_smbfs, /sbin/umount

This will allow the user fred to mount windows shares and unmount any filesystem.


Another note: If you would like the user to be able to use the sudo command without being prompted for a password simply add NOPASSWD to the end of the allowed command list, such as:

fred ALL=NOPASSWD: /usr/sbin/mount_smbfs, /sbin/umount

Comments