Skip to content

KALI – Start Kali with a new hostname on every boot


If you’re downloading a lot, you may find that the name of your device will be blocked.  There is a way to change your host name every time you reboot.  This is naughty but nice.  My cautions have been added to the end of the article.

Step 1 – Create a new file called

Use Gedit to create a new file.

Type this code into the file


cp -n /etc/hosts{,.old}

newhn=$(cat /dev/urandom | tr -dc 'A-Za-z' | head -c8)
hostnamectl set-hostname $newhn

echo "    localhost" > /etc/hosts
echo "    $newhn" >> /etc/hosts


Step 2 – Gedit a second file

The code is:

Description=Hostname Randomizer



Enable the service
systemctl enable changehost.service


Or run it at any time manually

service changehost start


I have seen companies and universities block the hostname rather than block an IP – so this should keep your laptop from being detected.


  1. If you are using OpenVAS, don’t do this.  OpenVAS uses an SSL certificate.  Any software that partially autheticates using the hostname will fail.
  2. Only use if you want to download a lot, and you’re being blocked.


Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: