Upgraded from 13.10 to 14.04 with wrong user name and can't access any files
I cannot login to the old username because it does not exist on the login screen. I cannot recreate the old username because I don't have root privileges. I have tried many methods of getting to root mode and none work. Is there any way of changing the new username to the old one?
I usually get this message:
sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
Solution 1:
Start by rebooting into recovery mode (covered on this question). Get up to the point where you're root.
After that look at stat /usr/lib/sudo/sudoers.so
. I see:
...
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
...
By the looks of it, that won't ring true for you but not entirely sure what you've done. If the owner isn't root or the permissions are anything but 0644, we can fix that quickly:
chown root: /usr/lib/sudo/sudoers.so
chmod 0644 /usr/lib/sudo/sudoers.so
If that permissions/ownership is the only problem, that should fix it. Just run reboot
to boot back into Ubuntu-proper.
If you nuked /usr completely (with a chmod -r ... /usr
, for example), you need to restore ownerships to a lot more files. Thankfully, /usr
is fairly rooty. You can restore the bulk of permissions with:
chown -r root /usr
chown daemon /usr/bin/at
chown libuuid /usr/sbin/uuidd
If you want to know how I got those two stragglers, I ran sudo find /usr -exec stat -c '%U %n' {} + | grep -v root
on a cleanish system. If you have a recent backup, I'd suggest running that against your backup.