checking how to reset sudo and root password on Ubuntu?? 21.04

Robert Heller heller at deepsoft.com
Sat Oct 15 15:10:07 UTC 2022


At Sat, 15 Oct 2022 05:47:05 +0200 "Ubuntu user technical support,? not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> On Fri, 2022-10-14 at 16:26 -0400, Robert Heller wrote:
> > 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.
> 
> Hi,
> 
> there is nothing bad with enabling the root account. There's nothing bad
> with logging in as root, just don't use root to start a X session.

True, *but* with sudo, having a root login is unnecessary and adds a 
*potiental* security risk.  

> 
> On Fri, 2022-10-14 at 16:26 -0400, Robert Heller wrote:
> > 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/.
> 
> IIUC the OP run chown recursively in the root directory, so just fixing
> the particular files in /etc isn't a good solution.

Also true, but it is a first step towards getting the system working again.

> 
> # # # #  # # # #  # # # #  # # # #
> 
> On Fri, 2022-10-14 at 15:13 -0500, Aaron Rainbolt wrote:
> > Ouch. There isn't really a good way to fix this with 100% accuracy
> > that I know of.
> 
> There is a way, just restore from your latest backup ;).
> 
> However, I agree, after accidentally running chown recursively it's some
> work too fix the owner and group of all files and without doubts we
> would miss one or the other important exception..
> 
> On Fri, 2022-10-14 at 15:13 -0500, Aaron Rainbolt wrote:
> > Once you're booted into recovery mode, select the "root" option to
> > drop to a shell, then run "mount -o remount,rw /" to gain write access
> > to the root drive. At this point, you can plug in an external drive,
> > find the external drive with lsblk, mount it to /mnt, and then use cp
> > or rsync to copy your important data to the external drive.
> 
> Don't try to rescue data from a broken install by running the broken
> install to copy the data. Use a live media that is _not_ broken, mount
> the partition/s containing the data and run "cp -ai", "tar --xattrs" or
> if you prefer rsync.
> 
> Regards,
> Ralf
> 
> PS: FWIW if a log in doesn't work anymore, it's possible to login from a
> live Linux using either chroot or systemd-nspawn to repair a broken
> install. In this particular case I wouldn't try to repair the install. I
> would restore from a backup. A user that has got no backup should
> consider to reinstall the OS.
> 
> 

-- 
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