Use usermod -l newuser -d /home/newuser -m olduser when renaming a user account, because it’ll update all relevant system files and move the home folder in one go.
Then groupmod -n newgroup oldgroup if you need to rename the group.
I had a vague memory of being able to change settings (shell etc.) by updating using vipw so I renamed there and then edited /etc/groups but I then got an error when trying to become that user:
To fix it, I had to update all these files (and rename the home folder):
vipw: updates/etc/passwdvipw -s: updates/etc/shadowwhich contains the password hashes and are only readable by rootvigr: updates/etc/groupvigr -s: updates/etc/gshadowthe same as passwd (also TIL, groups can have passwords)
This is what you get when you think you remember how things work, and didn’t want to look up how usermod worked, a little bit of knowledge is dangerous and all… 😅