32

In pretty much any GNU/Linux distribution you use sudo or su, What's the right choice for FreeBSD 10 ?

40

FreeBSD does support sudo it's likely just not installed by default. Installation instructions are here, titled: FreeBSD: Install sudo Command To Execute A Command As The Root.

As root:

FreeBSD < 10

# pkg_add -r sudo

FreeBSD 10+

# pkg install sudo

The default sudoers file is located here: /usr/local/etc/sudoers. To edit it and add rules you need to use the visudo command.

$ su -
$ visudo

Then to give a user access to everything as root:

userX ALL=(ALL) ALL

To become root (as userX):

$ sudo -s
-or-
$ sudo -i
  • Is there any way for "syntax=sh" or similar extensions? They are very useful for colorized interface. – Sopalajo de Arrierez Jan 7 '16 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.