Sudo password doesn't work even if I have no password

Solution 1:

sudo requires a password by default on Mac OS X.

Apple's knowledge base article explains more, Mac OS X: sudo command requires a non-blank admin password:

In Mac OS X v10.5 through 10.5.8, if you press the Return key at the password prompt without entering a password (even if the user has no password, which is not recommended), the command entered will not execute and you will be returned to a command prompt.

In Mac OS X v10.6 or later, if you press the Return key at the password prompt without entering a password, the message "Sorry, try again." will be displayed and you will be prompted for a password again.

If your administrator account has no password (a blank password), you must give that user a password before using the sudo command.

If you must remove the need for a password to use sudo, you can edit the /etc/sudoers file using visudo command. A thread on macoshints discusses how:

Use the visudo command as root.

Look for the line:

%admin ALL=(ALL) ALL

Change it to:

%admin ALL=(ALL) NOPASSWD: ALL

Requiring a password is highly recommended. Removing this check reduces the security of your Mac and exposes your computer to attack or abuse.

Solution 2:

Based off of what you have written so far, I am assuming you are running 10.7 or newer on your computer. When you have Mac OS Lion or newer then sudo actually requires a password either from an Admin account or with a password set up for root user.

If you are no admin then sudo is out of your hands. If you are then your password must be something. Leaving your password empty is not possible of you have to sudo. Temporarily add a password to the account and then proceed. If these tips don't help then please provide feedback with what you are experiencing in greater detail.