Can someone tell me how to change the computer name on a pc, I've tried to edit the
/etc/hostname file but it won't allow me access to save the amended file, thought the user the system created was the administrator obviously not.
Changing the hostname or computer name in ubuntu
Edit /etc/hostname and change to the new value, for example name we are using hostname Ubuntu
sudo nano /etc/hostname Ubuntu
Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname
127.0.0.1 localhost 127.0.1.1 ubuntu.local ubuntu # change to your new hostname/fqdn
Note : Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname (if you dont do this, you wont be able to use sudo anymore. If you hav e already done it, press ESC on the grub menu, choose recovery, and edit your host file to the correct settings)
Now after a reboot, your hostname will be the new one you chose
If you want to apply the change without a reboot,
sudo service hostname restart
sudo /etc/init.d/hostname restart
Note : Above command to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname).