Apple Intelligence is now available on iPhone, iPad, and Mac!

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 Top-ranking reply

Posted on Jun 29, 2013 6:13 PM

The problem (for me at least) is TextExpander. God knows how many times I have "nuked & paved" my Air in order to get rid of this problem.


TextExpander has a setting that capitalises the first letter of the first word of a "sentence". You type your password correctly & TextExpander cleverly capitalises the first letter. You can turn this feature off on an app by app basis in the Preferences.


If you are not using TextExpander then have a look at what else you are running that does something similar i.e. autocorrect or something like this.


I have conatcted Smile & also had this problem echoed at https://discussions.apple.com/thread/4607694?start=0&tstart=0 by joshsmith01.


Hope this helps.

35 replies
Question marked as Top-ranking reply

Jun 29, 2013 6:13 PM in response to Alberto Ravasio

The problem (for me at least) is TextExpander. God knows how many times I have "nuked & paved" my Air in order to get rid of this problem.


TextExpander has a setting that capitalises the first letter of the first word of a "sentence". You type your password correctly & TextExpander cleverly capitalises the first letter. You can turn this feature off on an app by app basis in the Preferences.


If you are not using TextExpander then have a look at what else you are running that does something similar i.e. autocorrect or something like this.


I have conatcted Smile & also had this problem echoed at https://discussions.apple.com/thread/4607694?start=0&tstart=0 by joshsmith01.


Hope this helps.

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.

Nov 21, 2012 4:56 AM in response to BobHarris

I'm resurrecting this thread because the same problem has happened again.


After trying all the suggestions above, thanks everyone, I finally gave in and did a clean install of Mountain Lion. I didn't migrate anything over from Time Machine or my clone, I just started from scratch and slowly started to add the apps I use the most.


Just recently I needed to use the sudo command in terminal and the same old problem rears it's head, it asks for my password and when I enter it I just get "Sorry try again".


This is only on my user account, which has admin privilidges. When I try on the "spare" admin account it works fine. Even more bizarre, I have three Macs and the same problem exists on all three. All three are running 10.8.2 and were all installed independently of each other.


I'm really stumped/frustrated by this as it's obviously something to do with how I'm using/set up the machines or maybe a piece of software I run.


If anyone has any ideas at all I'd be grateful. Thanks

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