From what I've read, it is good security approach to have two accounts, one admin and one standard.

I am trying to run the following command in terminal on my standard account

sudo mv /System/Library/CoreServices/Search.bundle /System/Library/CoreServices/Search.bundle.bak killall SystemUIServer

It asks for a password at which point the process fails because the current user "is not in the sudoers file."

Is it asking for my admin account password or root password? Do I have a root account/password if I haven't explicitly set one up? How do I temporarily elevate my access to execute the command without necessarily enabling root?

  • If the asker has lost control of this account, just register a new account and flag this for moderator assistance in merging the accounts if the self-merge portion of help center doesn't work. – bmike Nov 10 '13 at 6:25

The system is asking for the password of your account and then verifies whether you are allowed to run sudo based on the content of /etc/sudoers. By default only Administrators (which have the option ticket in Preferences) are allowed to do this.

In case you want to run shell commands with sudo without having to switch users all the time you have several options:

  • Use ssh <any-admin-user>@localhost to log in as an admin user and run sudo then
  • Add your non-admin user to /etc/sudoers by logging in as an admin user, executing sudo visudo in Terminal, duplicating the %admin ALL=(ALL) ALL line and replacing %admin with your username. This will allow you to use sudo in Terminal without giving you full admin access. Using visudo instead of editing the file directly will ensure that the file gets checked for syntactical correctness on save (an error in /etc/sudoers might lock you out of your system completely)
  • 2
    ssh is a bit overkill for this, and requires that you actually have sshd running. su <any-admin-user> would be better. – ughoavgfhw Nov 9 '13 at 6:02

I answered a similar question here

Seems like you could use the SU command to switch to another user in Terminal. Once you've switched to the admin user you can use sudo commands coupled with the admin account's password.

For example, when I'm at one of my end user's Macs and I need to run something with elevated privileges (chown for example) without logging out and into the admin account (ladmin) I would use something like this (in bold):

Mr-Rabbits-Mac:~ notadminuser$ su ladmin

This will prompt for the ladmin account's password, once entered you will see a bash command prompt. From here I can run any sudo commands desired, entering ladmin's password as needed...

bash-3.2$ sudo chown user2 /some/folder

This will run the chown command using the now logged in ladmin user, prompting for the ladmin account's password. Once finished you can type exit to return to your logged in user's prompt.

Screenshot of similar process, only using sudo to run the ls command (just for example). enter image description here

  • This is the correct answer to this question. I am surprised as to why it hasn't been upvoted! – Bendemann Jan 22 at 19:31

Open Terminal and login to your administrator account. It should look like this:

MyComputer:~ MyStandardAccount$ login MyAdminAccountName
Password: <enter password here> --The text you type will be invisible so no one can see the password
MyComputer:~ MyAdminAccount$ sudo mv /System/Library/CoreServices/Search.bundle /System/Library/CoreServices/Search.bundle.bak killall SystemUIServer
Password: <enter password here> --Text will be invisible again
MyComputer:~ MyAdminAccount$ logout
MyComputer:~ MyStandardAccount$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .