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?

Kantura
  • 4,705

3 Answers3

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

msw
  • 10,593
  • 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 Oct 05 '14 at 02: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 Oct 05 '14 at 03: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 Oct 05 '14 at 05: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 Oct 05 '14 at 09:47
  • @Kyrias in debian since at least version 5.0 (Lenny), the sudo group has sudo permissions by default. – Shadur-don't-feed-the-AI Oct 05 '14 at 10:53
  • Still needs to make sure his user is in the group, also that he's even using Debian. – remmy Oct 05 '14 at 11:31
  • @kyrias. I checked my /etc/sudoers file and it is completely empty. What should I see there? – Kantura Oct 06 '14 at 07:31
  • @Derek, That sounds like something is off. What distro is this on? – remmy Oct 06 '14 at 08:04
  • @kyrias, Scientific Linux 6. – Kantura Oct 06 '14 at 15:26
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.