Home > Linux, System Admin > Ubuntu 10.04 – How to rename a user

Ubuntu 10.04 – How to rename a user

A user can easily be renamed in the desktop using the Users and Groups applet found in Menu: System –> Administration–> Users and Groups.  However, renaming a user this way only changes his Full Name and does not fix up the home directory or other references.  Instead, to fully rename a user, the rename must be performed from the console.

A user can not be renamed while he is logged in.  Use a different admin user to perform the rename; create a temporary admin user that has rights to perform the rename if necessary (Menu: System –> Administration –> Users and Groups).

  1. Ensure that the desktop is logged out.
  2. Ctrl+Alt+F1 to get a console and log in as the admin user.
  3. Rename the old username to the new username (including the home directory):
    usermod -l <newname> -d /home/<newname> -m <oldname>
  4. Move the old user’s group to the new user’s group (the group name is typically the same name as the username):
    groupmod -n <newgroup> <oldgroup>
  5. Exit out of the console.
  6. Ctrl+Alt+F7 or Ctrl+Alt+F8 to return to the desktop login.
  7. Login and test the newly renamed user.
  8. To fix up the renamed user’s display name in Gnome. 
    1. Menu: System -> Administration -> Users and Groups
    2. Select the renamed user.
    3. Beside the user’s old name click Change…
    4. Set the user’s new Full Name.
  9. Remove the temporary admin user if necessary  (Menu: System –> Administration –> Users and Groups).  You may need to reboot if the system reports that the user is still logged in.

Note:  If your Linux image is running in VMware then CTRL-ALT-F1 won’t work directly since VMware uses CTRL-ALT to release the cursor.  Instead in VMware use CTRL-ALT-Space, then let go of space, then press F1 or F8 while still holding CTRL-ALT.

Reference:

Categories: Linux, System Admin
  1. No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.