Ubuntu – Recover sudo password of server over ssh

password-resetsshsudoUbuntuubuntu-12.04

I am working on an ubuntu 12.04 server and i was not provided a sudo password. Now i need to recover it. I found out that we need to reboot into recovery mode to do so but we don't know how to get into recovery mode through ssh.

Any idea of how is this possible or any other ideas for recovering the sudo password?
I have root access through ssh.

Update:

I've tried to do this:

su -

But without success:

su: Authentication failure

Best Answer

You cannot change your password due to the filesystem being mounted in read-only mode when booted into Ubuntu's recovery system.

See this AskUbuntu answer for more detail, but you will need to run the following command to re-mount the filesystem as read/write:

mount -rw -o remount /

After remounting, the output of the mount command should look similar to this for the root filesystem:

/dev/sda1 on / type ext4 (rw,errors=remount-ro)

As an aside, running su - as root will not give you any higher access - root is the highest possible on a Linux system.