Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Password not working with Sudo

Hi, I hope someone can help with this.


I'm trying to run a sudo command in Terminal and when it asks for my password I get "Sorry, try again".


My user account is set up as Admin and I've even tried enabling root user but that didn't make any difference.


The last time I tried sudo was in Snow Leopard and it worked fine. My current install was clean in Lion and then upgraded to 10.8 so there shouldn't be anything hanging around from the old 10.6 install.


Any suggestions as to how I can get my password to work would be appreciated.


Thanks

iMac, OS X Mountain Lion (10.8.1)

Posted on Sep 3, 2012 3:48 AM

Reply
Question marked as Best reply

Posted on Sep 3, 2012 3:49 AM

If you are getting only "Sorry, try again" it isn't accepting your password. I'm not sure why not.

You might try changing your password and see if it will work.

35 replies

Sep 5, 2012 1:22 AM in response to Barney-15E

Hi Barney, sorry for the delay in replying, I had to work away yesterday.


Ok I tried changing my password to "qwertyuiop" but still no joy. Still getting the same response. I think I'll have to ring AppleCare and see if they can sugest anything, but I'm guessing the next step will be to create a new user account and see if the problem persists.

Sep 5, 2012 1:29 AM in response to Barney-15E

Ha!, Well I took my own advice and created a new Admin account and gues what? Terminal accepts the password. Looks like my account is corrupt somewhere. Not sure if this means I need to move everything to a new account or if there are steps I can take to fix it. I'll try permisions repair first as that's the only thing that springs to mind right now.


Thanks for your help.

Sep 5, 2012 4:13 AM in response to sinjon2112

The basic Repair Permissions in Disk Utility won't affect your user account.

You can reset your home folder permissions by doing the following:

Boot into Recovery HD (hold down cmd-r on start).

When it boots up, go to the Utilities menu and select Terminal.

Type resetpassword and hit return

Select the volume (Macintosh HD by default)

Select your Account

Click the Reset Home Folder permissions and ACLs button.


You can quit and restart from there.

Sep 6, 2012 12:56 AM in response to BobHarris

Hi Bob, thanks for looking. Yes I've done the whole password reset thing, both within System Prefs and also from the Recovery Disk utility and yes I am using the correct password for the logged in account.

I did try enabling root user, just so I could execute the command, but that made no difference, it wouldn't accept the root password either.

There must be something up with my user account as when I try the same command from my "stand by" Admin account, which I don't generally use, it works fine.

Sep 6, 2012 3:51 AM in response to sinjon2112

Use the standby admin account to look at the /etc/sudoers file to see if there is anything amiss in the file


Wild guess/idea, check you home Folder's permissions to make sure the do not allow anyone else write access. I know ash refuses to do some things if it thinks someone could put a Trojan file in your home folder. Compare against standby admin.


Check what groups you are in, and compare against standby admin


id -a


There is some difference between the 2 accounts, and what is in /etc/sudoers.

Sep 7, 2012 2:35 AM in response to BobHarris

Hi Bob


I've checked my Home folder permissions in Get Info and they are idetical to Admin standby user, ie "Username"(me) Read & Write, staff Read only, everyone, Read only. All the folders except Applications & Public have the red "no entry" icon in the bottom right corner when viewed in Finder from the Admin account.


Below is the terminal output for id -a


id -a

uid=501(nigelmonks) gid=20(staff) groups=20(staff),12(everyone),33(_appstore),61(localaccounts),79(_appserverusr) ,80(admin),

81(_appserveradm),98(_lpadmin),100(_lpoperator),204(_developer),401(com.apple.ac cess_screensharing)


This is identical to the output for the Admin user account.


And here is the content of the sudoers file


# sudoers file.

#

# This file MUST be edited with the 'visudo' command as root.

# Failure to use 'visudo' may result in syntax or file permission errors

# that prevent sudo from running.

#

# See the sudoers man page for the details on how to write a sudoers file.

#


# Host alias specification


# User alias specification


# Cmnd alias specification


# Defaults specification

Defaults env_reset

Defaults env_keep += "BLOCKSIZE"

Defaults env_keep += "COLORFGBG COLORTERM"

Defaults env_keep += "__CF_USER_TEXT_ENCODING"

Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"

Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"

Defaults env_keep += "LINES COLUMNS"

Defaults env_keep += "LSCOLORS"

Defaults env_keep += "SSH_AUTH_SOCK"

Defaults env_keep += "TZ"

Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"

Defaults env_keep += "EDITOR VISUAL"

Defaults env_keep += "HOME MAIL"


# Runas alias specification


# User privilege specification

root ALL=(ALL) ALL

%admin ALL=(ALL) ALL


# Uncomment to allow people in group wheel to run all commands

# %wheel ALL=(ALL) ALL


# Same thing without a password

# %wheel ALL=(ALL) NOPASSWD: ALL


# Samples

# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom

# %users localhost=/sbin/shutdown -h now


Hope this is of some use, as I've no idea what I'm looking for with this 🙂


Thanks again for your help.

Password not working with Sudo

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.