I need to use sudo but when I try to use it, a prompt tells me the command is not found and I need to install sudo.
So when I switch to su so I can gain root access to install sudo, it says auth failure
How can I fix this?
I need to use sudo but when I try to use it, a prompt tells me the command is not found and I need to install sudo.
So when I switch to su so I can gain root access to install sudo, it says auth failure
How can I fix this?
Boot up the machine, and after the BIOS screen, hold down the left Shift key. You will then be prompted by a menu that looks something like this:
If instead you get options like:
You need to go to Advanced Options using arrow keys and hit Enter and then choose the recovery mode
Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.
Using the arrow keys scroll down to network and hit Enter to enable networking. If asked to remount the partition, hit Enter on yes.
And then go to root in the same menu and then hit Enter.
You should now see a root prompt, something like this:
root@gijs-pc:~#
At this stage you might have a read-only filesystem. You have to remount it with write permissions:
mount -o remount,rw /
now, install sudo
by:
apt install sudo
check your sudo settings once again by:
visudo
also, check if your account gijs
is a member of sudo
If not, add him as a member of sudo and wheel group by:
usermod -aG sudo gijs
usermod -aG wheel gijs
Now, you may restart and you now should have access to sudo.
This answer is abridged version of Jorge Castro's answer on How do I reset a lost administrative password?
sudo
to installsudo
. Even more ironic that it would probably suggest the same thing again if you actually typed the command it had suggested to you. – kasperd Mar 02 '19 at 10:41