1

I installed sudo on NetBSD 7.0 using pkg. I copied /usr/pkg/etc/sudoers to /etc/sudoers because the docs say /etc/sudoers and possibly /etc/sudoers.local is used. I uncommented the line wheel ALL=(ALL) ALL. I then added myself to the wheel group. I verified I am in wheel with groups. I then logged off and then back on.

When I attempt to run sudo <command>, I get the standard:

jwalton is not in the sudoers file. This incident will be reported

What is wrong with my sudo installation, and how can I fix it?

jww
  • 11,918
  • 44
  • 119
  • 208
  • 1
    isn't it `%wheel` for a group? – Alex Jun 08 '16 at 22:37
  • @Alex - good catch - I think the odd key mappings from OS X to the VM and emacs caused the deletion of the leading `%`. I re-added it, but still encounter the problem. Let me try to add myself to `staff` next (I tried to add myself to `sudo` but it results in an error *`can't append group 'sudo' for user 'jwalton'`*). – jww Jun 08 '16 at 23:32
  • Try adding yourself to the `%sudo` group too, `usermod -G sudo jwalton` – Alex Jun 09 '16 at 00:07
  • @Alex - the command `usermod -G sudo jwalton` failed with the message `can't append group 'sudo' for user 'jwalton'`. – jww Jun 09 '16 at 00:53
  • Then you don't have enough privileges. – Alex Jun 09 '16 at 01:06

1 Answers1

3

sudo(8) as installed by pkgsrc is configured to look in /usr/pkg/etc/sudoers. It will not look at /etc/sudoers.

If you're updating your access control via visudo(8), it should be modifying the correct file. If you're not updating the sudoers file via visudo(8), please start doing so.

  • Thanks Eric. Are you certain about *"/usr/pkg/etc/sudoers"*? The docs state otherwise. Unfortunately for *" ...if you're not updating the sudoers file via visudo(8), please start doing so..."*, I don't use vi; rather, I use emacs. I know its pretty much a religious debate, but I learned emacs in college 20 years ago, so I don't want to learn another editor. – jww Jun 09 '16 at 22:40
  • The documentation on a NetBSD system is going to override anything else on the 'net. Read the manual pages on NetBSD to learn how any software will work on NetBSD. – Eric Schnoebelen Jun 09 '16 at 22:59
  • visudo is a wrapper around $EDITOR or $VISUAL, so will use your favorite editor. Part of visudo's functionality is to validate the format of the sudoers file, so you really want to use it (much as you would use vipw to edit/validate the master.passwd file.) – Eric Schnoebelen Jun 09 '16 at 23:00
  • OK, thanks. The location of the sudoers file was the problem. Its unfortunate that SEO hijackers have manged to supplant [NetBSD project as the source of the information](http://www.google.com/search?q=netbsd+sudoers). – jww Jun 10 '16 at 00:02
  • Note that someone removed the forced setting of `sysconfdir` during configuration to `/etc` (thus defaulting it to `$PKG_SYSCONFDIR`, which does default to `/usr/pkg/etc`, _but_ it is often customized), but the same patch does not fix any references in the manual pages, so strictly speaking both the linked manual page in the original post, and the actual manual page in any pkgsrc installation, will in fact refer only ever to `/etc/sudoers`. Personally I think forcing `sysconfdir` to match the documentation is better than changing it and leaving the documentation wrong as was done. – Greg A. Woods Jun 13 '16 at 19:14
  • Also note: the link to the referenced documentation in the original post _is_ the link to the _official_ manual page for third-party software for NetBSD. – Greg A. Woods Jun 13 '16 at 19:18