Linux Ubuntu is a supremely flexible platform, with various customizations and tweaks available for the user in both the standard desktop user interface and via the terminal to allow the user to make any number of changes based on their own particular preferences.
Some of these might be the obvious repositioning of the desktop layout, perhaps making the menu panel invisible or changing the background, even resizing the desktop to take advantage of a larger monitor resolution or swapping the desktop theme for something more “in-tune” with the user’s tastes.
By default in Ubuntu, you will have a login name set up, which when entered along with your password will enable you to login to your computer. The login name is setup when you first use the computer, but you might find that you have mistyped or simply want to change the entered username as time goes on. While it might not be immediately obvious how to do this (there is no option from the login box) there are various ways of changing your original login name in Ubuntu.
Image credit: Wikimedia Commons/Sertion
Two Ways to Change, but Which is Most Efficient?
There are two very different ways in which you can change your original login name in Ubuntu; both work in any current version, such as Maverick Meerkat or Natty Narwhal. The first is simple, but potentially intimidating for anyone who doesn’t have experience with Linux, while the second is also initially simple but can result in countless profiles and Home folders littering your hard disk drive.
In the interests of spreading the word on how easy Ubuntu is to use we’ll avoid encouraging you to create a second user account and instead focus on the usermod command, which can be used to make all manner of changes to an Ubuntu login.
This useful command can be used to not only change the login name but also lock or unlock a password, set an expiry date and various other related functions. By taking advantage of the usermod command a new login name can be applied in a matter of seconds.
Modifying Your Login with Usermod
In order to change a login name, you will need to also copy the contents of the related Home folder. This can be done relatively quickly with a single command via the terminal (Applications > Accessories).
The following command allows you to change a login while also instructing Linux to move the existing Home folder to the new one that is created when the login is changed:
usermod -l newname -m -d /home/newname oldname
There are two ways of applying this change. If you are the administrator and are changing logins for other users, you shouldn’t have any problem applying this change from the main Ubuntu user interface. However, if you are a single user and wish to make this change, then you will need to do this from the Recovery Console.
You can access the Recovery Console after your computer starts by tapping Shift, which forces the GRUB Loader screen to open. From here, select the version of your operating system that is labelled (recovery mode) and when this has loaded, use the command above to change your own user login.
Terminal and Recovery Mode Safety
While there is little that a newcomer can do to upset the running of your Ubuntu box from the terminal or recovery mode shell, it is important that when making this change to your login name you enter the new username exactly as you intend to use it, without any changes. If this is your first time making such a change, it might be worth keeping a note of the changes.
The reason for this is simple – if you change your username and mistype it then after changing your original login name in Ubuntu, rather than having a new login that you’re happy using you might be unable to login at all, a problem that will occur particularly on computers with multiple users.
Find Out More About Usermod
As described above, the usermod command is very useful and offers a whole host of options that can be used to adjust Ubuntu login details.
You can find out more about the command in our usermod tutorial but for a more hands-on introduction to the function, you can open the Ubuntu Terminal (Applications > Accessories) and enter the following instructions:
This will launch the Ubuntu manual, starting at the usermod section, and here you will see the various ways in which the command and its options and switches can be used.
As you should have seen, usermod is a very useful command to know, and should be pretty easy to learn, especially if you use this handy on-board reference to check from time to time.
Author’s own experience.