The common scenario:
You installed Ubuntu Server and named your initial user something stupid. Now you need to change it. This is the only user with sudo permissions and if you try to change it while logged in as it, it won’t work. Here is the work around…

1. Create a TEMP user.
2. Add TEMP user to sudo group
3. Use TEMP user to change first user (we will called first user ADMIN in this example) login name
4. Delete TEMP user

First, login as your current sudo user (in this example, “admin”) and elevate privileges, then create new user and set password…

sudo -s
useradd -G sudo temp
passwd temp
shutdown now -r

Logout and log back in as the new “temp” user. Elevate privileges and change username of first account (ADMIN).

sudo -s
usermod -l localadmin admin

Log back in as the renamed admin user (renamed above to “localadmin”) and delete out the temp user.

sudo -s
deluser temp
rm -r /home/temp

All done!

REFERENCES:
http://www.cyberciti.biz/faq/ubuntu-add-user-to-group/
http://askubuntu.com/questions/34074/how-do-i-change-my-username

1 of 1

This post has no comments. Be the first to leave one!

Join the discussion

Your email address will not be published. Required fields are marked *