So, here's an interesting dilemma brought to me by a friend. He is new to OS X, and decided he wanted to change his short username (later on, he admitted all he really wanted to change was his home directory name, but whatever). I didn't know of an easy way to do this, so I recommended just creating a new user and copying all of the files in his home directory into a new directory, testing it, then deleting the original user if all seemed well. Well he stumbled across NetInfo manager and figured he could just start changing stuff in there instead. Bad idea, though I must say I warned him generally about NetInfo beforehand (perhaps I shouldn't have mentioned it at all).
So now his short user name has changed, but not his home directory, and of course the system no longer recognizes him as an admin so he's kinda stuck. In fact, it recognizes no admin users on the system at all. And root is currently disabled, and with no way to authenticate in NetInfo, root cannot be enabled. Now, I'm pretty sure I remember being able to enable root using the X install disc, at least in 10.1. And we'll probably end up enabling root that way if nothing else works so he can create a new admin user and take it on as his own.
But, partially as a lesson to him and partially as a way to learn more about it myself, I'm trying to figure out if there are other ways to fix this short of reinstalling Jaguar (which is what a Mac Genius suggested to him). Essentially, are there ways to enable the root user within a shell? Is it as easy as setting the root password (root has never been enabled)? An additional problem is that he can't sudo to try changing the root password, since his username no longer is recognized as an admin. I had thought about booting up in single-user mode and trying to set a root password that way. It seems from what I've read that he'd probably have to run the /etc/rc script to start NetInfo first. Or, I also thought we could either edit or replace with a previously edited copy his /etc/sudoers file, including his new username in the list, since the error he gets when trying to sudo now is that he's not in that list.
So am I on the right track? Will any of this work? Is there a way to instead try and return things to the way they were from a shell? Say if we could return his short username to what it used to be so the system once again recognized him as an admin? This would of course also require some sort of root or sudo access I'm assuming.