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

ETID

macrumors regular
Original poster
Jan 6, 2008
148
0
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
 
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

It is the password for the administrator of the computer. The user that you created when you first setup OS X.
 
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.
 
  • Like
Reactions: jerwin
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
 
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!
 
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
 
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.

...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.
 
...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.
Sudo has some security issues too, and I'm not talking about human error.
 
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...
 
  • Like
Reactions: gatoru
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...

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.
 
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
 
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.
 
But when the password prompt is presented, it doesn't let me type anything. If I stroke a key, it doesn't respond. Help.

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
 
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

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.
 
When you type in 'su' without any other arguments you are switching to the root user, and this assumes you know the root password.
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.
 
Now, its showing me weird symbols and question marks along with the error noise.
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
 
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)

Detrius said:
...or "sudo -s"

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

B
 
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 ???
 
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 ???

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.
 
Last edited:
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

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.