Recently, I was setting up an Ubuntu VirtualMachine, and drukenly mistyped the primary username.
This is pretty easy to fix very quickly, thought I would share.
First, boot GRUB into recovery-mode, and choose root-shell from menu.
We need to find out what I drunkenly typed, and fix it by moving the user to what I meant.
mount -o rw,remount / catpasswd
At the end, I saw
konsmuer should be
konsumer. Oh dear!
At this point, I can pretend I am French (pronounced “kon sew mway”), and just leave it. Now that I know how it’s spelled, I could login with my new name, or I can fix it. I think you know what I did next.
Now for the fancy replacement:
cd /etc # gives list of files to change - check these grep -R konsmuer # do change, automatically for i in `grep -R konsmuer -l .`; do sed -i 's/konsmuer/konsumer/g' $i done
This means “find all files that have ‘konsmuer’, and in-place modify them with sed using a search/replace for ‘konsumer’”.
If you messed up typing the password too, type this:
Lastly, let’s move yer home dir:
mv /home/konsmuer /home/konsumer
Now, reboot, and you can login with your corrected user.
I was having funny little issues on Ubuntu 12.10 64bit, and realized that it was using a really old version of node.