He, Peng

A Roboticist.

Robotic is the integration of all human knowledge, so far.


Change the Username and Hostname on Ubuntu

Abstract: If you didn't give a perfect user name and host name(the computer name), you can change them later.

Change the username

At the start screen press Ctrl+Alt+F1.
Log in using your username and password.
Set a password for the "root" account.

sudo passwd root 

Log out.

exit

Log in using the "root" account and the password you have previously set.
Change the username and the home folder to the new name that you want.

usermod -l <newname> -d /home/<newname> -m <oldname>

Change the group name to the new name that you want. I'm not so sure about which group should I change to

groupmod -n <newgroup> <oldgroup> 

Lock the "root" account.

passwd -l root

If you were using ecryptfs (encrypted home directory). Mount your encrypted directory using ecryptfs-recover-private and edit <mountpoint>/.ecryptfs/Private.mnt to reflect your new home directory.
Log out.

exit

Press Ctrl+Alt+F7.

Change the hostname, which is the computer name

Type the following command to edit /etc/hostname using nano or vi text editor:

sudo nano /etc/hostname

Delete the old name and setup new name.
Next Edit the /etc/hosts file:

sudo nano /etc/hosts

Replace any occurrence of the existing computer name with your new one.
Reboot the system to changes take effect:

sudo reboot

Change the password

passwd

Super easy, isn't it?

Recent Posts

Back-propagation in Neural Network, Octave Code

Abstract: This post is targeting those people who have a basic idea of what neural network is but st…

In Machine Learning, Neural Network, OctaveRead More
Earlier Posts

Linux Essentials

Install Deb. Pkg from Command Line You can install it using sudo dpkg -i /path/to/deb/file followed…

In ConfigsRead More
comments powered by Disqus