How to switch from defaultuser to nemo

I do this with every device. Defaultuser is just too long. It’s the uid that does all the work so it’s quite trivial. It’s something like:

  • Move /home/defaultuser to /home/nemo
  • Symlink that back to make sure both are valid for a bit.
  • Use vipw to switch the name in the passwd and shadow files. The shadow files won’t let you edit them even as root, so you have to switch the permissions temporarily while you do it. Use chmod u+w /etc/shadow and /etc/gshadow beforehand, and u-w to switch them back after.
  • Use vigr to rename the group, and switch all the usernames in each group for both the group and gshadow. Search and replace with :%s/defaultuser/nemo/g

But I always forget at least one step every time, and then the device doesn’t boot and I have to reflash it. Second time is usually a charm though.

13 Likes