"sudo su" not worked :(

Discussion in 'macOS' started by hack3rcon, Apr 15, 2015.

  1. hack3rcon macrumors member

    Joined:
    Nov 26, 2014
    #1
    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?
     
  2. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #2
    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.
     
  3. lowendlinux Contributor

    lowendlinux

    Joined:
    Sep 24, 2014
    Location:
    North Country (way upstate NY)
    #3
    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
     
  4. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #4
    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.
     
  5. lowendlinux, Apr 15, 2015
    Last edited: Apr 15, 2015

    lowendlinux Contributor

    lowendlinux

    Joined:
    Sep 24, 2014
    Location:
    North Country (way upstate NY)
    #5
    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.
     
  6. Warhaven macrumors newbie

    Joined:
    Mar 3, 2010
    #6
    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.
     
  7. doynton macrumors 6502

    Joined:
    Oct 19, 2014
    #7
    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
     

Share This Page