I made a huge mistake of not paying enough attention while changing some config files in an Ubuntu VM. By missing a space in a file path, I accidentally changed the name of /etc/ to /etc2. As a result, I can't run sudo
because there is no path /etc/sudoers
, and now when I try and run sudo
I also get sudo: unknown uid 1000: who are you?
Is there any way I can recover from this?
Sure, shutdown your VM, create (or use) another one with a Linux distribution, attach the virtual disk to the new one, boot it, mount the faulty VM root file system under /mnt
, rename /mnt/etc2
back to /mnt/etc
, shutdown the VM, detach the disk, reboot the original one, that's it ...