Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to make a normal user can install package with pkg_add on FreeBSD?

pkg_add -r command fails with normal user with sudo. Downloading succeeds, but installation fails with this error message. Equal command executed successfully with root login.

%sudo pkg_add -r apache22
Error: Unable to get Syntax error, command unrecognized
pkg_add: unable to fetch '' by URL

Assume my username as eonil.

I added

eonil ALL=(ALL) ALL

code as next of

root ALL=(ALL) ALL

via visudo, and added the user to wheel group by

pw usermod eonil -G wheel

. But the user cannot install package with sudo pkg_add -r apache22. (not only the apache, any package.)

share|improve this question
Post the line you added to /etc/sudoers for this as well as log output of the failure when this command is run. – EEAA Feb 27 '11 at 5:37
@ErikA I added some more detail codes. Thanks for care. – Eonil Feb 27 '11 at 5:50
What happens when you try to run the pkg_add command via sudo? Please post any error messages. – EEAA Feb 27 '11 at 5:52
@ErikA I added error message I got. Thanks again :) – Eonil Feb 27 '11 at 5:57
up vote 1 down vote accepted

Problem in env vars.

Uncomment or add line in sudoers(run visudo command):

share|improve this answer
Thanks. It's working now! – Eonil Feb 27 '11 at 6:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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