Open root terminal without switching user (OS X)

2

I'm not in sudoers:

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

How can I sudo in this terminal window, without switching user?

The well-known command sudo -u administrator -i also gives the above message.

Dmitry Isaev

Posted 2012-10-17T09:04:04.063

Reputation: 176

Answers

3

Say your admin account name is admin, then:

su admin

Then you are the admin user...

.....

And Gordon Davisson has a good suggestion. When you're a user with admin rights, you can use sudo to get root rights even if there is no root user. And you can use "sudo john" to become user John without knowing his password.

SPRBRN

Posted 2012-10-17T09:04:04.063

Reputation: 5 185

Not helpful. He wants to be root, but root doesn't permit 'su' on OSX. – Mike Heinz – 2012-10-17T11:35:52.723

It's exactly what I need! No need to change the current user policy (unlike the below answer). Thanks to rxt. – Dmitry Isaev – 2012-10-17T12:21:26.107

@MikeHeinz: he can use su to switch from a standard user to the admin account, and then sudo to switch from admin to root. – Gordon Davisson – 2012-10-17T14:48:25.713

0

Make sure your account is an admin user, not just a regular user. Go to system preferences, users, and check the box labelled "Allow user to administer computer".

Mike Heinz

Posted 2012-10-17T09:04:04.063

Reputation: 161

0

You will once have to become an Admin-user with su admin (or use an administrative account) and the run visudo (or sudo visudo). That will open up the sudo-config file.

There you can scroll down to the end and add a line for yourself like username ALL=(ALL) ALL. Save the file and from now on that user usernamecan run sudo without the error-message.

Oh, and when you use username ALL=(ALL) NOPASSWD: ALL you will not even need to provide your password.

heiglandreas

Posted 2012-10-17T09:04:04.063

Reputation: 1 153

I've already said about "no change to the current user policy", so @rxt's answer is enough. – Dmitry Isaev – 2012-10-18T05:47:46.737

actually it's not a change to the user policy as the user is still not an admin user. It only allows usage of the sudo command for the given user. But when you are satisfied, thats OK. – heiglandreas – 2012-10-18T07:15:04.947