Having built a new server in the summer, I thought I’d post a little tip for if you decide to change the hostname in Ubuntu. I got caught out after completing steps 1 to 3 and then rebooting the server! Couldn’t SSH into it after it rebooted. Had to get the spare monitor out and figure out what I’d missed…
- check firewall rules ufw that 22 is open
- change /etc/hosts
- change /etc/hostname
- change /etc/ssh/*.pub with new hostname otherwise you won’t be able to SSH into the machine any more!
Now you can reboot