Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
Not helpful. He wants to be root, but root doesn't permit 'su' on OSX. –  Mike Heinz Oct 17 '12 at 11:35
    
It's exactly what I need! No need to change the current user policy (unlike the below answer). Thanks to rxt. –  Dmitriy Isaev Oct 17 '12 at 12:21
    
@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 Oct 17 '12 at 14:48

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".

share|improve this answer

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.

share|improve this answer
    
I've already said about "no change to the current user policy", so @rxt's answer is enough. –  Dmitriy Isaev Oct 18 '12 at 5:47
    
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 Oct 18 '12 at 7:15
    
Anyway, thanks! –  Dmitriy Isaev Oct 18 '12 at 8:45

Your Answer

 
discard

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.