1

I am trying to use su and sudo on my iMac that I did a fresh clean install of Mac OS X 10.9 and Server 3.0. I explicitly set the password for root with

passwd root

but when I try to use su or sudo from a local network account, it does not accept the password. When I was reading through some of the man pages for su, sudo and passwd, one of them (but I do not remember which) mentioned something about different behavior in an Open Directory environment. I tried digging around but could not find any more info.

Can anyone help me here?

2
  • 1
    You don't need to enable the root account to use sudo. Are you sure using just an admin account is not enough?
    – nohillside
    Commented Nov 20, 2013 at 15:56
  • No, I am trying to stay away from using the local admin account as much as possible. As such, my desire is to be able to use sudo while logged into a local network account. Commented Nov 22, 2013 at 0:39

1 Answer 1

2
dsenableroot -u $ADMIN_USERNAME -p $ADMIN_PASSWORD -r $ROOTSNEWPASSWORD

replace the variables with your admin username and password as well as the password you desire for root. At that point, you could sudo as the admin user or just su - and use the root password you set to become root.

In the end, you'll want to either configure sudo to allow the commands you use often from your non-admin account or get used to typing the root password when needed.

2
  • I was able to get it to set the password while using the local admin account, as I get the message ***Successfully enabled root user. However, when I try to use su or sudo after setting the password, it will not accept my password. Commented Nov 23, 2013 at 16:34
  • @SillyGoof I've added an edit - once you've set root's password, you can su to root, but sudo still won't work with the steps listed above.
    – bmike
    Commented Nov 25, 2013 at 20:17

You must log in to answer this question.

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