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.
Thanks
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.
Thanks
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
OR
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).
You need to change 2 files and can use the following commands for that...
pkexec nano /etc/hostname
pkexec nano /etc/hosts
Only change the name; nothing else.