Skip to content

Instantly share code, notes, and snippets.

@htaghizadeh
Created January 3, 2019 07:02
Show Gist options
  • Save htaghizadeh/51fa125c87c9836529734e5f60e5f3ce to your computer and use it in GitHub Desktop.
Save htaghizadeh/51fa125c87c9836529734e5f60e5f3ce to your computer and use it in GitHub Desktop.
Summary:
sudo hostname NEW_NAME_HERE
sudo nano /etc/hostname # change OLD_NAME by NEW_NAME
sudo nano /etc/hosts # change OLD_NAME by NEW_NAME
sudo systemctl restart systemd-logind.service
hostnamectl set-hostname NEW_NAME_HERE
Also you should recreate your ssh keys on your machine:
sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
Just in case, check references of your old hostname on /etc and fix it:
sudo grep -R pulex /etc/ 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment