su password in terminal

Discussion in 'Mac Basics and Help' started by ETID, Apr 28, 2008.

  1. ETID macrumors regular

    Joined:
    Jan 6, 2008
    #1
    Hi I am trying to do the su command in terminal and when it asks for the password I have no idea what it is. Is there a default password or something because it is not my login password

    thanks
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    It is the password for the administrator of the computer. The user that you created when you first setup OS X.
     
  3. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #3
    When you type in 'su' without any other arguments you are switching to the root user, and this assumes you know the root password.

    I think, instead of 'su', you want to use the 'sudo' command, i.e:

    sudo su

    Which, will prompt you for your own password. If you're in the administrator group, and root is enabled, successfully authenticating with your password will switch you to the root user.
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    Ah, of course. Sorry disregard my post.
     
  5. ETID thread starter macrumors regular

    Joined:
    Jan 6, 2008
  6. zrankin macrumors member

    Joined:
    Jun 16, 2009
    #6
    so i have the same problem but I just left my password blank when i set up my mac... but when im in terminal and try to just hit enter, it does authenticate
     
  7. dtalamo macrumors newbie

    Joined:
    Dec 28, 2009
    #7
    Terminal password????

    I have the same problem. I left my password blank when i set up my mac... now when I'm in terminal, using the comand "sudo" it asks me for my password and I just leave it blank and just hit enter, it comes back saying sorry, try again and asks me for password again. What have I overlooked? What else can I try?

    Thanks for any help in advance!
     
  8. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #8
    Setting a password seems like a prudent next step. You can do this under the Users panel of system preferences. Passwd from the terminal will likely work, too, but it seems safer to do through system preferences.

    -Lee
     
  9. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #9
    ...or "sudo -s" to get to a root shell. Also, you do NOT have to enable the root user for this to work. "Enabling the root user" just involves setting a password for root. sudo gets around the lack of a root password. su requires knowing it. Therefore, sudo is better because you can give multiple people access to root without telling them the root password.
     
  10. MorphingDragon macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #10
    Sudo has some security issues too, and I'm not talking about human error.
     
  11. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #11
    What, like the fact that it caches your status for a few minutes?
     
  12. UnixNut macrumors newbie

    Joined:
    Jan 3, 2010
    Location:
    Virginia
    #12
    Loging in as root at the terminal

    Type in "sudo passwd root" (To change root's password to what you want)

    Then type in "sudo su -" (To Switch-User to root in the terminal, prompt should change from ~$ to ~#)

    Hope that helped...
     
  13. Billy Boo Bob macrumors 6502

    Billy Boo Bob

    Joined:
    Jun 6, 2005
    Location:
    Dark Side Of The Moon
    #13
    I set the root password like that all the time, but I don't have to sudo into su -... I can just issue "su -" and enter the root pass to go in as root.

    Keep in mind, too, that you can change the default shell of the root user if you like... In Finder, go in as Administrator (Login Window), then open System Prefs -> Accounts and right click on the Admin name in the list to go into Advanced Options... In there you can set the default shell.
     
  14. peggyli macrumors newbie

    Joined:
    Sep 8, 2010
    #14
    su in terminal

    I still have a lot of problems in using su in terminal after searching/reading many answers to the problem in this Forum and other websites. My problems are :

    1. I enabled the Root User in the Directory Utility of the Utilities in Applications.

    Then at a terminal, I typed:

    su
    password:

    I got the error message:

    su: Sorry.

    I logged out and logged in again and tried again. But still got same error message.

    In the login window, I logged in as usual using the Admin login option as this is the only available in the login window. I did not see the 'Other Users' option in the login window. So I could not try to login as "root", is this the problem?

    2. I tried sudo, but got error message :

    >>> sudoers file: syntax error, line 32 <<<
    sudo: parse error in /private/etc/sudoers near line 32

    I went to /private/etc and opened "sudoers" file with emacs. There is nothing in the "sudoers" file.

    Need some help!

    Peggy Li
     
  15. travis2ninja macrumors newbie

    Joined:
    Feb 16, 2011
  16. dmabster macrumors newbie

    Joined:
    Feb 18, 2011
    #16
    Im having a similar problem

    But when the password prompt is presented, it doesn't let me type anything. If I stroke a key, it doesn't respond. Help.
     
  17. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #17
    It does not *echo* keystrokes. It is accepting a password, it's just not showing what you type (even placeholders) so an on-looker cannot capture your password. Just type your password, trusting that even though you have no visual indication it's being accepted, and press enter.

    -Lee
     
  18. dmabster macrumors newbie

    Joined:
    Feb 18, 2011
    #18
    Thanks lee. Put in my password. Did not deny it. Now, its showing me weird symbols and question marks along with the error noise.

    Between this and other recent events, my computer appears to be possessed.
     
  19. Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #19
    Thanks, I prefer to be the superuser when I need to do what only superusers usually have permission to do. The "sudo" command can annoy me.
     
  20. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #20
    What was the rest of your sudo command? Sounds like you may have dumped a binary file to the console.

    BTW. A little tip, if you have access to sudo, i.e. you are an admin account and know your account password, but don't know the root password anymore you can usually get by with the following command to "become" root.
    Code:
    sudo su -
    
    B
     
  21. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
  22. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #22
    Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5)

    You learn new things every day. Thanks for adding another shortcut to my arsenal.

    B
     
  23. megaman1522 macrumors newbie

    Joined:
    Feb 24, 2011
    #23
    Help please

    i need to put limited user in sudoers file withought using admin password or account, how do i do this? this has to be possible ???
     
  24. Guiyon, Feb 24, 2011
    Last edited: Feb 24, 2011

    Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #24
    No, and this sounds slightly suspect. The whole point of the sudoers file is so that root/admin users can define and grant sudo privileges for others. Allowing J. Random User to jump into root privs. at any time (or grant those privileges to others) is a massive security hole, at best.
     
  25. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #25
    It's just a shortcut for entering:

    sudo bash

    or even (depending on what the default shell is)

    sudo sh


    It's honestly probably better to do:

    sudo su -

    Because that takes it through a full login shell. There might be environment variables that might need to be set for root for everything to function as expected.
     

Share This Page