Aug 24

How to change username when you have only one account in Ubuntu?

You cannot simply login as root in Ubuntu at the start up. Do it as the following way:

1) Open terminal and switch to root user. You can open terminal in search or by pressing Ctl+Alt+t.

2) Unlock root account and enable login as root like below

# passwd -u root (:::should be as root)

3) Reboot the machine

4) Once the login page appears, press Ctrl+Alt+Fx (x can be from 1 to 6) to open a terminal. Then switch root user and enter root password.

5) Change the username of account you wanted to.

# usermod -l newname oldname

6) Change the home folder name of user to new one if you want to. But this is optional.

# usermod -m -d /home/newname newname ((this would change home/oldname to /home/newname))

7) Lock the root account again

# passwd -l root

8) Switch back to GUI(the graphical login page at startup)

# Ctl + Alt + F7

(If it’s not working just reboot using “reboot” or “shutdown -r now” command)

Login with new username and enjoy working 🙂

((Above method is needed when only single user account is present in ubuntu. When you have only one account, you cannot do this username change by standing in the same account environment))

Leave a Reply

Your email address will not be published.