sudo won't work.

Travis86

Registered
Alrighty, I was trying to install MySQL without the GUI installer. Since there was no /usr/local directory, I tried to create one. I didn't have the privilages to do that, so I tried "sudo mkdir local". It asked me for my password, and I hadn't enabled the root user, so I had to go do that first. Then I try "sudo mkdir local" with the root password, but it says my password is incorrect. No matter how many times I try or if I set the root password again, it still won't work.

Also, if I'm using sudo for the first time, why does it ask for a password? Is there some sort of default password that I don't know about?

I found someone else with the exact same problem elsewhere, but the people there said to reinstall. I don't think I need to reinstall when my computer is only seven days old.

Also, someone mentioned the problem here, but I don't reall know what they're talking about. $PATH looks ok to me.

Does anyone know what's wrong??
 
you do not have to have root user enabled to use sudo - i use it all the time.

You do however have to be a member of group admin i believe. if you check the sudoers file (which you cant because only the superuser can read it) i think it specifies which users or groups are allowed to use sudo.

Check the man file "man sudoers" but it is very long...
Interestingly i cant su to root - but i guess thats because i dont have root enabled.
 
Ok, here's my /etc/sudoers file.
Code:
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# 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

# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL

According to "id", my user belongs to the admin group, so there shouldn't be any problem, right? If there isn't anything wrong with this file, what could be the matter?

Thanks.
 
how did you manage to read that file if you cant use sudo?

-r--r----- 1 root wheel 341 13 Sep 2003 /etc/sudoers

it should only be able to be read by root or wheel - and administrators in OS X are not in group wheel

If your permissions are not as above then i suggest you do a repair permissions on your drive - I know this is a standard fix issued by anyone/everyone on this forum but it might be justified in this case!

The sudo password is you normal OSX password - sudo authenticates you based on the sudoers file, provided you are in a group that is allow to sudo (which you are).

Strange. Do a repair permissions and tell us what happened!
 
I was able to read /etc/sudoers because I switched to root to do it. If I could do that as my normal admin user, something would really be messed up!

But all that aside, you have solved my problem. I thought sudo wanted my root password, when it really wanted my normal password. I don't know as that makes since, but at least it works. I was getting really worried there for a while. It's not a good feeling thinking something might be wrong with your brand-new computer. Phew!
 
I run my account as a "normal" user in OS X but have enabled 'sudo' permissions for Terminal stuff; keeps my son's wandering fingers (or mine, for that matter) from doing any accidental damage to the GUI side of things but allows me the flexibility to work in Terminal as needed.

Simply add yourself to the sudoers file while your account is enabled as admin, then demote yourself back to a normal user once that's done.
# User privilege specification
root ALL=(ALL) ALL
legacyb4 ALL=(ALL) ALL
%admin ALL=(ALL) ALL

Of course, I have a proper admin account set aside for any other use if the need arises...
 
when using sudo, just use the admin login and password

I run it from other profiles or from my own, just type in the login and password of the admin account.

or get the easy install version - www.serverlogistics.com
 
I wonder if there is a little confusion here that is making things much more complicated than they need to be. When you use sudo to do a root thing you need to use your user password. This is in contrast to the way one uses su where you would have entered the the root password.

It would be a good idea to disable the root password you enabled as it is an added security issue. Not a big one but one nonetheless.
 
Back
Top