Change username

From ArchWiki
Revision as of 09:22, 24 May 2009 by Graysky (Talk | contribs) (how to rename a user safely)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Changing a username under Arch (or any flavor of Linux) is safe and easy when done properly. It's also very important that you also change the associated groupname for the user. Following the procedure below will do just this retaining your UID/GID for the affected user thus not roaching any file permissions you have setup.



Warning: Make certain that you're not logged in as the user whose name you can changed! Open a new tty (ctrl+alt+F1) and log in as root or as another user and su to root.

Changing the username/group

Basically, you have four commands to type as root to change the username and group. They are as follows:

# mv /home/oldname /home/newname
# usermod -l newname oldname
# groupmod -n newname oldname
# usermod -d /home/newname newname

If you want to see what each command is doing, check out the manpages for usermod and groupmod.


  • Anything on your system (desktop shortcuts, shell scripts, etc.) that uses an absolute path to your home dir (i.e. /home/oldname) will need to be changed to reflect your newname.
  • I had to repeat the procedure to [enable spell checking] in Firefox or else the check-as-you-type spelling didn't work for me.