Setting The Hostname

Mar 13, 2018

On Mac 10.13.3 :

$ sudo scutil --set HostName <hostname>
$ sudo scutil --set LocalHostName <hostname>
$ sudo scutil --set ComputerName <hostname>
$ dscacheutil -flushcache

$ sudo hostname -s <hostname>

Restart your Mac for now.s

On Debian:

$ sudo vim /etc/hostname
<hostname>

$ sudo vim /etc/hosts
127.0.0.1 <hostname>

$ sudo hostname servicename

exit and ssh login again.

On Centos 7:

$ sudo hostnamectl --static set-hostname <hostname>

exit and ssh login again.