I am trying to use sudo on a linux server but have forgotten my password. is there any way to retrieve it?

Is this the same password I use to login to ssh?


1 Answer 1


sudo is a utility to execute a command as another user. So if you have superuser-privileges, then you (your current user) can run a command as e.g. the root-user. Therefore you only need to use the password you also use for login.

But it might be that you do not have superuser-privileges. This is defined in the root-only readable file /etc/sudoers. There you find a line similar to

%sudo   ALL=(ALL:ALL) ALL

(although another group name could be used instead of sudo, e.g. wheel, depending on your distribution). Any user part of this group is able to run the sudo-command.

If you cannot run sudo, you are probably not part of this group (or you just became part of the group and need to logout and then login again).

You must log in to answer this question.

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