Tuesday, December 17, 2013

Rename an account in Ubuntu

To rename an account in ubuntu along with its home directory you can use usermod:
$ man usermod
The usermod command modifies the system account files to reflect the changes that are specified on the command line.

For example I want to rename an existing user called vic which has home directory in /home/vic/.

I want the user to be called vic_old and its new home directory to be /home/vic_old.
$ sudo usermod vic --login=vic_old --move-home --home=/home/vic_old
Note: you should be logged in as another user, otherwise this will fail with:
usermod: user vic is currently used by process 5882

No comments:

Post a Comment