All operations from sudo user sudo su
1. Replace old name with new name in files:
/etc/hostname
/etc/hosts
2. Run commands inĀ terminal:
1 2 3 |
sudo hostname mynewname sudo systemctl restart systemd-logind.service hostnamectl set-hostname mynewname |
3. Recreate ssh keys on the machine:
1 2 |
sudo rm /etc/ssh/ssh_host_* sudo dpkg-reconfigure openssh-server |
After reboot machine should be accessed by new name