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.

Situation: I'm running OS X 10.8.3 and i have 2 users, an Admin user and a Standard user. When i'm logged in as the standard user and i need to run a command with admin privileges in the terminal i use:

    su myadmin
    <enter the password>
    sudo bash
    <enter the same password... again>
    easy_install etc  (run the priveleged command)
    exit
    exit

Question: Can i do all of this in just 1 single terminal command, and only having to enter the admin password 1 time?

EDIT: fyi so far i found this, it's 1 command but it still requires me to enter the same password 2 times:

su myadmin -c 'sudo easy_install etc'
share|improve this question
add comment

1 Answer

If you are comfortable editing the sudoers file (/etc/sudoers), you can add a line like:

USERNAMEALL=(ALL) ALL

It will give USERNAME the ability to sudo as root directly.

So, to do the above, you would just type:

sudo easy_install etc

Note that you would enter the password for USERNAME after the sudo command, and not the admin password. If you have set up your standard user account without a password, then this probably will not work

share|improve this answer
    
Okay thanks for your answer. That would kind of defeat the purpose of using a 'standard' account instead of an 'admin' account. I'd rather not give my standard user account additional permissions. –  Daps0l May 24 '13 at 12:06
    
Almost... as far as I know, the GUI layer of OSX would still require you to put the actual admin username and password in before running installers, etc. It uses the unix group membership, and not sudoers. –  Kent May 24 '13 at 21:53
add comment

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.