How To Change Username On Ubuntu, Debian, Linux Mint Or Fedora

This is a step by step guide on how to change your username on Debian, Ubuntu, Linux Mint (and other Linux distributions based on Debian/Ubuntu), and Fedora.

The instructions explain how to change (rename) the username along with the user's home folder name, as well as a simple work-around for potential issues with configuration files that still point to the old home folder name. There's also a step for changing the full name (display name), which is shown on the login screen and other places throughout the desktop.


Throughout all the instructions / commands below, remember to replace newusername with the new username, and oldusername with the ... old username.

1. Create a temporary user and give it sudo privileges.

We'll login with the temporary user to perform the username change commands. This way there won't be any issues running them from the same user we're trying to rename (e.g. processes running for that user, etc.).

Add a new temporary user (tempuser) and give it sudo privileges on Debian, Ubuntu or Linux Mint (after entering a password you can keep pressing Enter to skip entering the rest of information):

sudo adduser tempuser
sudo usermod -aG sudo tempuser

Add a new tempuser and give it sudo privileges on Fedora:

sudo adduser tempuser
sudo passwd tempuser
sudo usermod -aG wheel tempuser

2. Login with tempuser and change (rename) the username, home folder and group.

Logout, and on the login screen select tempuser and login with that user. Next, open a terminal and run these command to change your username, home folder, and group from oldusername to newusername:

sudo usermod -l newusername -d /home/newusername -m oldusername
sudo groupmod -n newusername oldusername

If you get an error about a process being in use for the old username, kill that process (kill PID), but that shouldn't happen in most cases since we're logged in using a temporary, intermediate username to make these changes. If it does happen, another workaround is to reboot and then login straight with tempuser, that way there aren't any processes used by the old username.

3. Create a symbolic link from /home/newusername to /home/oldusername.

Some applications will show errors when changing the username, because in some cases there are configuration files that point to the old username's home folder. A solution for this is to create a symbolic link from the new home folder to the old home folder:

sudo ln -s /home/newusername /home/oldusername

4. Change the display name / full name (firstname lastname).

In my case, trying to rename a username on Ubuntu 19.04 and Fedora 29, the display name (full name) remained unchanged on the GDM3 login screen and on the user menu. This can be changed though, using:

sudo chfn -f "firstname lastname" newusername

Replace firstname and lastname with your first and last name, or whatever you want to show up on the login screen and various other places throughout the system. firstname and lastname can also be one item, e.g. your new username.

The chfn command is available on Fedora in the util-linux-user package, which is not installed by default. You can install it on Fedora using:

sudo dnf install util-linux-user

After installing this package, the chfn command should work on Fedora.

5. Login using the new (renamed) username, and delete the temporary user created on step 1.

Logout and select the new, renamed username from the login screen, and proceed to login. You can now delete the temporary user created in step 1 (tempuser) and its home folder:

sudo userdel -r tempuser