how rename ubuntu user code example
Example 1: ubuntu rename user login
#As root / or as another user.
# Kill the processes of the user to rename
pkill -u <OldLoginName>
#Rename user login
usermod -l <OldLoginName> <NewLoginName>
#Rename HomeDir
sudo usermod -d /home/NewHomeDir -m NewLoginName
Example 2: change ubuntu username
# To manage every aspect of the user database, you use the usermod tool.
# To change username (it is probably best to do this without being logged in):
sudo usermod -l newUsername oldUsername
# This however, doesn't rename the home folder.
# To change home-folder, use
sudo usermod -d /home/newHomeDir -m newUsername