I have a user named
hedgehog and I want him to be named
squirrel, but I don't want to change his numeric user ID.
How can I accomplish this?
Under Linux, the
To change just the username:
To change the username and home directory name:
You may also want to change the name of the group associated with the user:
Generally you can rename a user by changing their username in the
Note that the method above does not rename other things which may bear the original username (home directories being the prime example, per-user personal groups (on systems which use them) being another). You may wish to clean these up as well for consistency, by changing the appropriate fields in the passwd file and renaming the directories.
Several operating systems provide a system-specific way of renaming users. For example many Linux systems include the
The straight out way of doing this is:
Please, don't try this if your directory is encrypted!
If that is your case you might want to check:
Or even just creating a user and rsync 'ing the old user home folder to the new and then chown 'ing it.