Change Login and Home Folder in Ubuntu Server

To change login username and home folder, first restart Ubuntu Server in recovery mode.
$ sudo poweroff/reboot

During reboot, choose recovery mode and choose root session, and then remount the file system as read-write:
$ mount -o remount,rw /

Now rename home folder, move contents and rename login and account name.
See http://manpages.ubuntu.com/manpages/trusty/man8/usermod.8.html
$ usermod -d /home/[newhomedir] -m [currenthomedir]
$ usermod -l [newlogin] [currentlogin]
$ usermod -c "New User Name" [login]

Then change group name, which also can be done outside recovery/root session:
$ groupmod -n [newgroupname] [currentgroupname]

Optionally, to reset the password:
$ passwd [username]

To see list of users:
$ cat /etc/passwd
$ less /etc/passwd
$ more /etc/passwd

Or, to list just logins:
$ awk -F':' '{ print $1}' /etc/passwd

Lastly, poweroff and reboot:
$ poweroff

Or
$ reboot

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.