Sometimes you might reach that point in your life when you get bored with your username or wish to change it to bring different networks closer together.

For example, for years my login name at home has been “penguin”. Now, to aid in integration between my working life and my home life, I wanted to change my username at home to be the same as my username at work.

Before modifying usernames, the very first step is to ensure you have a root user password set.

On Ubuntu and some other distributions, this is disabled by default as a security measure but if something goes wrong, you’ll have a nightmare trying to fix it.

This tutorial assumes that the account you normally log in with has sudo privileges. If not, you will need to speak to your system administrator in order to change your username.

For all commands you will need root priviledges.

Standard filesystem

Firstly set the password for root

Next, logout of any graphical sessions you have open. This is important or certain files and directories cannot be moved.

The next step is to switch to a pure terminal session and login as root. To switch away from the graphical login, on Ubuntu press ctrl+alt+F[1-6].

Once logged in as root, you need to update the username in all of the following config files.

Now change directory to home and execute the following:

If you’re not running encryption, thats it, end of lesson. However if you are running encryption, there is a bit more work to do.

Encrypted filesystem

For encrypted files, the following commands also have to be carried out before you will be able to login.

Thats it. You should now be able to login with your new username. Remember to unset the root password after completion. Root should never be able to log in.

To unset the root password, as your normal user type “sudo passwd root” and press return twice. Ubuntu prevents accounts without a password set from logging in.

Leave a Comment