|02-19-2013, 09:29 AM||#1|
Join Date: Feb 2013
sudo suddenly won't accept my passowrd
I'm on macbook os x 10.5.8
Short story: the sudo command won't take my password.
The way it happened:
I wanted to change a file name, so I typed "sudo mv /pathtofile/file newfile". As I was typing my password, I realized that I had mistyped the destination file name, so I pressed enter before finishing to type my password thinking that that would allow me to fix my command and re-enter my password. The next time I tried doing sudo mv etc... I got "Sorry, try again", and then "3 failed attempts" or something of the sort. Apparently, my blunder has caused me to not be part of sudoers anymore. I don't know how to fix that.
|02-19-2013, 11:45 AM||#2|
Join Date: May 2004
First, try opening a new Terminal window and try sudo there. You can also try logging out or rebooting.
Second, if that doesn't work, paste the contents of /etc/sudoers
Third, if your name (or group, are you an admin user?) isn't listed there, you'll likely need to boot into Single User Mode and make the correction there.
Finally, in the future you cancel your current command using "Control c". Though, I doubt that's what caused the problem.
i am jack's amusing sig file
|02-19-2013, 12:14 PM||#3|
Join Date: Jun 2003
Location: Boulder, CO USA
At least on my computer, /etc/sudoers has permissions -r--r----- with ownership by root/wheel.
In other words, unless you are root or are a member of wheel, you need sudo to be able to read sudoers. (If you have a password set for root, you could of course su to root and see it from there. But it's not a good idea for your computer's security to have a password set for root.)
It's probably not as satisfying but I would hope nearly as convincing, to just look at the date that /etc/sudoers was last modified to see if it was somehow messed up. I also doubt that /etc/sudoers is what is causing the problem, but try
ls -TOel /etc/sudoers
If the date it was last modified was recently, then you may be on to something. I suspect that the date /etc/sudoers was last modified was quite some time ago, so you have not recently affected it in any way.
By the way, an alternate way to see the contents of /etc/sudoers without having the ability to use sudo is to boot to single user mode, as fracai alluded. That puts you into an environment with root privileges, so you will be able to read the file.
How to ask questions the smart way
|02-19-2013, 12:24 PM||#4|
Join Date: Jan 2002
Did 'sudo' work sometime recently before the command that you refer to as a "blunder"?
It seems unlikely that that command was the cause for your current situation.
|02-20-2013, 06:07 PM||#5|
Join Date: Apr 2008
Location: Berkeley CA USA
I've never seen the need to modify /etc/sudoers.
If I'm logged in as my non-admin user (the usual case) and want to do some admin work (using sudo, for example) and don't want to use Fast User Switching or similar to get an admin GUI environment (big hassle, especially since I can't copy/paste nor even view windows between the environments), what I do is:
su -l boss
... other stuff needing admin privilege ...
where boss is the name of my admin user. That is, with no change to /etc/sudoers, I can still use sudo freely, the only cost being (a) I have to know an admin user's password, and (b) I have to type it twice. I think that's reasonable.
Back to your original problem: You could create a new admin user, and use that user to fix whatever problem you're having. To create a new user, you need an admin's password, which you should have if you've been entrusted with sudo privileges.
If you don't know an admin's password, talk to whomever does. They're the one who should be helping you with this, not us.
Something you might try in the meantime: I doubt that /etc/sudoers has been modified. More likely, some sort of timeout was imposed. That timeout has surely expired by now. If it hasn't, you could try sudo -K to kill it. (That won't require a password.) Not sure if that will work, since the timestamp it kills measures when you need to enter your password again, not when you may enter it again, but it can't hurt to try.
|password failure, sudo|
|Display Modes||Rate This Thread|