Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hack3rcon

macrumors regular
Original poster
Nov 26, 2014
118
2
Hello.
I create an admin account and a normal account. when in normal account i open Terminal and type "sudo su" it ask me password and when I enter "admin" password it show me incorrect password.

How can I solve it?
 
Are you putting the admin password or roots? root is an account and if you created a second admin account, then the new admin's password may not be the same as root. It all depends on how you set both up.
 
Hello.
I create an admin account and a normal account. when in normal account i open Terminal and type "sudo su" it ask me password and when I enter "admin" password it show me incorrect password.

How can I solve it?

Admin is not Root in OS X like it is in some Linux distros and it's not as simple to create a root user i.e. sudo passwd.

https://support.apple.com/en-us/HT204012

You need to enable root see above link
 
You don't need to enable the root account for sudo. It does need to have a password and if the OP set that up, it may very well be different then the second admin account he created.

No but he will for the su switch

**edit** thinking about it you might be right su doesn't always imply root.

**edit 2** after 2 minutes of googling su is root in OSX so if there is no root password sudo su won't work

**edit 3** Ok the reason sudo su won't work is regular users are not in the sudoers. Even if the user is admin sudo su will not work until you establish a root user. If you add the non-admin user to the sudoers it just makes them admin. I just tested this on the MacBook because I thought it was interesting.

**edit 4** From the normal account you can su "admin account" and get the adminstrator user the you can do what you need to do if that user has privleges. If not that user is in sudoers and if you did establish a root you can sudo su and then move to root.
 
Last edited:
I think I know what the problem is. You're 95% of the way there. Simply omit the sudo portion, if I'm correct in my assumption that you want to do adminy things from the command line whilst logged in to a normal account.

su adminShortName
<type in admin password>

su is "substitute user". So, what we're doing here is switching to the admin account. Now that you've switched to the admin account, you can start doing things that require sudo to work.
 
You don't need to enable root.

When you enter sudo su it is the same as Linux - you have to enter your own password - not the password of root or the password of some administrator account.

The sudoers file looks like this in Yosemite:

Code:
# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL

You can therefore not use sudo for a non admin account.

If you want to do that then sign on as any admin account add add the user "fred" for example to sudoers file. Then when you sign on as fred, type sudo su and enter fred's password.

Code:
# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL
fred    ALL=(ALL) ALL
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.