Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Unix: How to sudo a command as admin from a standard account in terminal?

Unix: How to sudo a command as admin from a standard account in terminal?
Thread Tools
Dedicated MacNNer
Join Date: Aug 2003
Status: Offline
Reply With Quote
Sep 3, 2009, 08:07 PM
 
Is it possible to run a sudo command in terminal as an admin/different account when a standard account is the one logged in?

I tried doing a su <user> but then I get a # prompt. I hope I'm making sense, and I'm still learning unix! If anyone can help I'd appreciate it! Thanks
     
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Sep 3, 2009, 10:09 PM
 
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Online
Reply With Quote
Sep 4, 2009, 03:56 AM
 
Since the thread turtle linked is a bit long, it boils down to this:

You can't sudo from a user account, and you're not supposed to be able to. You can use su as you're trying, but then the syntax is

su - username

Alternatively, use fast user switching and switch to an admin user to do your dirty work. That's what I do.
The low-end Mac Pro is the most overpriced Mac since the IIvx
     
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Sep 4, 2009, 04:38 AM
 
Yes, I do it frequently:
Code:
su admin Password: ******* sudo -s Password: *******
If the short name of the user who is the admin is not admin, you need to change it accordingly. sudo -s will give you a root shell so that you don't have to write sudo this and sudo that all the time. The second password is identical to the first, by the way.

Please use your powers responsibly
I don't suffer from insanity, I enjoy every minute of it.
     
Dedicated MacNNer
Join Date: Aug 2003
Status: Offline
Reply With Quote
Sep 4, 2009, 08:57 AM
 
Thanks all!
     
Posting Junkie
Join Date: Oct 2005
Location: Houston, TX
Status: Offline
Reply With Quote
Sep 4, 2009, 05:45 PM
 
Originally Posted by herbsman View Post
Is it possible to run a sudo command in terminal as an admin/different account when a standard account is the one logged in?

I tried doing a su <user> but then I get a # prompt. I hope I'm making sense, and I'm still learning unix! If anyone can help I'd appreciate it! Thanks
You were already there. The # prompt has the credentials of whoever you just su'd to.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:58 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2