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

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,052
175
Norway
I sometimes need to use the sudo command, for instance after reading how to make OSX 10.6 search filename by default, but I can't figure out the password.
I actually have two user accounts on my Mac: an "administrator" and a "standard" user, and I've tried both passwords to no avail, so what do I enter when the terminal asks me the following?:

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
 
You need to run that command from an account that has admin privileges and use that account's password. Also, there is no gain is security by having a separate admin account on Mac OS X, just a waste of time mostly.
 
Thanks, that worked!

By the way, instead of logging out, then into the administrator user, is there a way I can log into the administrator user with a Terminal command for stuff like this? That way I won't need to reopen all my apps, open files etc. the way I left them before logging out of my normal user account.
Yes, I know about the "fast user switching" option, but I have enough menubar icons already to cause a clutter and it's not something I need to do every day.

PS: why do you say that having a separate administrator user doesn't make the computer any safer?
 
Make your regular account an admin. Because of Mac OS X's UNIX roots, if you or the computer wanted to do anything that requires admin rights, you would have to enter your admin password. In the past with Windows 2000 and XP, if your account as an admin account, everything was done with admin rights. Then Microsoft released Vista with its User Account Control feature. With this, your admin account only has admin rights when needed for that one thing. That's what UNIX provides Mac OS X with, admin rights only when needed for that one thing. When you are normally using your admin account on Mac OS X, it is in normal rights mode and can't do admin stuff. Thus, the need to type in your password. Because of this, there is no security gain to having a separate admin account on Mac OS X or Windows Vista/7/8.
 
Yup, that login command did the trick!
Finally, for that occasional stubborn software with installers which refuses to install when using the "normal" account (it installs fine when logged in as administrator though) -is there a way I can install that as an administrator but when logged in as a normal user? I'm guessing it's not possible other than doing it from the Terminal window (after doing a "login ADMIN_PASSWORD") and some command to open and run the installer...

I created an admin and normal user so I could put my home directory on a separate drive from OSX (the latter being on a (small) SSD). I also believed it would be safer than just having one user with one password.
 
Just check the box to make your normal account an admin account and leave it checked. All problems related to this will be solved by doing that.
 
Great advice!
In case others are wondering and can't find it: open the "Accounts" System preference. Select the user you want to give administrator rights, then enable "Allow user to administer this computer" found in the various options (be sure the "Password" tab is selected and not "Login items").
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.