How to rename a user safely?
13,276
Solution 1
Safely? Don't rename at all. Instead, (make sure the user is logged out first) create a new user with the correct username, rename the old home directory to the new username and chown -R the folder to the new user.
This assumes that you're not using encrypted homes. That would require some different steps, but since I haven't done that myself, I'll leave that to someone else.
Solution 2
Use usermod
like so:
usermod -l newname currentname
Related videos on Youtube
Author by
Ivan
Updated on September 18, 2022Comments
-
Ivan over 1 year
I've misspelled user name when installing Ubuntu and would like to rename if possible. How can I safely change my user name?
-
Takkat over 12 yearsThis answers may still be valid.
-
Ivan over 12 years@takkat thanks. There you've got a good formal answer on how to rename a user. But I believe Jo-Erlend's suggestion I've got here is safer :-)
-
Takkat over 12 yearsIf you haven't done much with your user, I'd definitely go for Jo-Erlends approach. I had other people in mind that may come here for a more sophisticated solution on this topic. Renaming users is not a trivial task.
-