Changing the hostname
Change the hostname in the following two files:
(You'll need to use
sudo to edit these files. Eg.
sudo nano /etc/hostname)
Changing the username
First, set a password for root:
Then reboot the machine. When you see the login screen, switch to a virtual terminal using CtrlAltF4. Login with the username
root and the password you set previously.
It's now safe to change the username using the following three steps:
Rename the user:
usermod -l newUsername oldUsername
Change the name of the user directory to match the new username:
mv /home/oldUsername /home/newUsername
Update the user database:
usermod -d /home/newUsername -m newUsername