5

When installing things I am sometimes asked for my sudo password. I don't remember ever having one or setting one. But I do know my su password which has always worked fine for me. It is not the same as my sudo as it doesn't work when I try it.

How do I find out what my sudo password is?

3 Answers 3

5

It is usually your personal login password. For example:

derek$ sudo ls /var/log/secret
[sudo] password for derek: <type derek's login password> 
audit.log  audit.log.1  audit.log.2

This can be altered by policy files such as /etc/sudoers. See for example Set sudo password differently from login one

9
  • I tried my login password (lets say it is "hello") and some incorrect passwords. When I try incorrect passwords I get:Sorry, try again. When I try my login password I get:hello is not in the sudoers file. This incident will be reported.
    – Kantura
    Commented Oct 5, 2014 at 2:56
  • 3
    You, user derek, may not have sudo permissions; ask your sysadmin. In your comment you gave a weird error message "hello is not in the sudoers file" I thought our hypothetical user:password was derek:hello; I would expect an error "derek is not in the sudoers file" but sudoers never contains passwords.
    – msw
    Commented Oct 5, 2014 at 3:08
  • Sorry, I made a mistake. It did return "derek is not..." not "password is not...". Also it is my personal laptop. I guess I am the sysadmin.
    – Kantura
    Commented Oct 5, 2014 at 5:17
  • 2
    @Derek That means that your user is neither in /etc/sudoers nor in a group that is. Common convention is to have a group called wheel that will have sudo access and then add users to that group.
    – remmy
    Commented Oct 5, 2014 at 9:47
  • @Kyrias in debian since at least version 5.0 (Lenny), the sudo group has sudo permissions by default. Commented Oct 5, 2014 at 10:53
0

If you have root password.

Look in file /etc/sudoers. You will find a line like %sudo ALL=(ALL:ALL) ALL, make a note of the word after the %. Now add your self to this group. Logout. Login. Now sudo should work for you.

If you don't have root password, then use a live distro to do what is described above.

-4

Maybe you have not set your root password. Try running:

$ sudo passwd

Then input your desired password.

2
  • 1
    You mean sudo passwd? Commented Oct 5, 2014 at 4:51
  • 1
    Also, sudo has to be configured to use the target user's password instead of the user who's running the command's password.
    – remmy
    Commented Oct 5, 2014 at 9:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .