FreeBSD → How To Add, Delete, and Grant Sudo Privileges to Users on a FreeBSD Server

https://www.cyberciti.biz/faq/freebsd-install-sudo-command/
https://www.cyberciti.biz/faq/how-to-add-delete-grant-sudo-privileges-to-users-on-freebsd-unix-server/

How do I configure sudo?
The default configuration file is located at /usr/local/etc/sudoers. This file MUST be edited with the visudo command as root. Failure to use visudo may result in syntax or file permission errors that prevent sudo from running.
su -
visudo

OR create a new config file /usr/local/etc/sudoers.d/adminuser:
visudo -f /usr/local/etc/sudoers.d/adminuser

Next, allow user vivek to run all admin tasks via sudo:

vivek ALL=(ALL) ALL
Allow members of group wheel to execute any command:

%wheel ALL=(ALL) ALL
Save and close the file when using vim/vi by pressing the Esc+:x+[Enter].

posted @ 2025-02-27 14:52  严肃活泼快乐有趣  阅读(16)  评论(0)    收藏  举报