checking how to reset sudo and root password on Ubuntu 21.04

Robert Heller heller at deepsoft.com
Fri Oct 14 18:08:07 UTC 2022


At Fri, 14 Oct 2022 17:41:25 +0000 "Ubuntu user technical support,? not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> Greetings,
> I recently recovered an Ubuntu 21.04 box I had set up back then, and then "leased" to a relative.
> I will upgrade it asap to 22.04 LTS, BUT, for reasons not relevant here, while doing backups and
> generally "cleaning up" that box:
> 1) I made a mistake, issuing a chown command in /, thus messing up, among other things,
>     ownership of critical files in /etc/, so now sudo does not work anymore
> 2) AND I forgot the root password, so I cannot just "su" and fix those ownerships manually

Ubuntu does not (normally) set a root password and you cannot (normally) log
into root. (One does 'sudo su -l root' if one must have a root login shell.)

> 3) but again, I have to fix those ownerships and other stuff, and back up before upgrading.
> I know I could boot a live distro and work from there but I have very slow connectivity right now,
> AND I want to refresh my skills for these situations  anyway, just to have more alternatives.
> So, since I CANNOT risk to mess up that box even more, I would really appreciate a confirmation
> that the root password reset procedure described here:
> https://unixcop.com/how-to-reset-root-password-on-ubuntu-21-04/ (https://unixcop.com/how-to-reset-root-password-on-ubuntu-21-04/)
> is 10% complete and correct for Ubuntu 21.04, and if there are better ways to reset a root password at the prompt, without using
> a live distro.

You don't actually need to set / create a root password. If you can single
user boot (or boot to bash as shown in the above page), you can fix the
persmissions/ownership at that point (at least on the root file system). No
need to fully boot the system and log in as root.

> TIA,
> Marco
> 

-- 
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
           



More information about the ubuntu-users mailing list