0

I have a corporate account work on my macbook that has administrator privileges and created a non-administrative account local.

Logged in as local, when I tried a command with sudo, I got the familiar is not in the sudoers file.

The file /etc/sudoers is owned by the usual root/wheel. I tried to modify the file inside a su work shell but it was readonly for that user. Then I tried su root but that didn't work either. Then I found out that I need to enable to the root user.

I enabled the root user, but still cannot su root, still get the same terse su: Sorry. I seem to have enabled the root user correctly, since the process to enable it now gives the option to disable it or change password.

How can I get su to work for user local? Is there a another way to allow the user local to use sudo?

  • 1
    You do not need to enable root - the normal way is from the admin account sudo visudo which opens vi on the sudoers file – Mark May 12 '13 at 17:42
  • Thanks @Mark, that is exactly what I ended up doing. I think I first tried sudo visudo inside a su - <admin-account> but it failed and later the samething from a ssh <admin-account>@localhost did, I could be wrong but now my non-privileged account is in sudoers and I am happy camper. – Miserable Variable May 13 '13 at 16:16
1

I found out that the I was able to modify /etc/sudoers when I logged in as work using ssh. Not sure if I had made some mistake with my previous attempt with su - work.

The following steps worked:

  • Logged in as local, start with ssh work@localhost
  • sudo visudo
  • Add entry local ALL=(ALL) ALL
  • Save and exist vi
  • Exist ssh session
  • Try sudo ls /
  • 1
    The issue is you need to be an admin user to edit sudoers and so you have to be logged in as work. – Mark May 12 '13 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .