Score:-3

Sudo Command Missing

mx flag

The Sudo command is missing on a ubuntu machine and I can't do an apt-get update because I don't have access to the root password any ideas?

ru flag
Is this your system or run by someone else? If it's not your system, then you need to contact the admins of that system. It's not uncommon for people to remove `sudo` if users added to the system are not allowed to be doing admin tasks.
mark haus avatar
sn flag
Try this: https://www.makeuseof.com/fix-sudo-command-not-found-on-linux/ This is the answer that worked for me. Hopefully you'll be sudoing soon!
Score:2
st flag

In a terminal type:

which sudo

That should give you an output of something like:

/usr/bin/sudo

If that doesn't, then it's not installed on the machine. The only way to use the superuser account in that case is:

su -

It will ask for a password, but if you don't know the password for the root account you're not getting into the machine at that point.

Score:0
az flag

You have to use su - command to log in as the root to install sudo tool. This will ask you to give the admin password. In Ubuntu, this is a random string that was generated by the OS during the installation. So you don't have a way to know it. There is a way to change the root password. But unfortunately, you need sudo command for that also.

So you have to reinstall Ubuntu on your machine.

sean avatar
st flag
Not necessarily... If the computer is not encrypted you can pop over to a Ubuntu live disk, mount the partition of the dive, change your passwords (for root), and then copy over the /etc/passwd and /etc/shadow files and get into it. Although that is pretty "hacky" it's valid recovery technique. I'm mostly mentioning it here to let people know that the unencrypted filesystem is unsafe. :D Reinstall should be a last ditch thing.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.