checking how to reset sudo and root password on Ubuntu? 21.04
Robert Heller
heller at deepsoft.com
Fri Oct 14 20:26:44 UTC 2022
At Fri, 14 Oct 2022 19:30:22 +0000 "Ubuntu user technical support,? not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:
>
> On Fri, Oct 14, 2022 at 20:09, Robert Heller wrote:
> At Fri, 14 Oct 2022 17:41:25 +0000 "Ubuntu user technical support,? not for general discussions" 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.)
> cannot do that, sorry if it was not clear:
> #> sudo su -l root
> sudo: /etc/sudo.conf is owned by uid 755, should be 0
> sudo: /etc/sudo.conf is owned by uid 755, should be 0
> sudo: /etc/sudoers is owned by uid 755, should be 0
> sudo: no valid sudoers sources found, quitting
> sudo: error initializing audit plugin sudoers_audit
> Marco
I understand -- you don't actually need to set a password for root, and
*generally* you really should not even try and it is bad practice to even
allow root to login.
You should just boot single user (or with init=/bin/bash) and instead of using
the passwd command to set a root password, just fix the ownerships of the
files under /etc/.
>
--
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