Kali Linux is becoming popular and more and more users are using it to try out different things. When installing kali, you get to choose a hostname, but in case you accepted the default hostname (kali) and later want to change it, here’s a How-to guide to change hostname in Kali Linux.
Now just changing hostname to something else might not be enough. How about we change hostname every time you boot your computer to a random one? That could be fun. It also helps to avoid suspicion from System Admins in your network to see “kali” in their network. Like BackTrack, SysAdmins doesn’t like Kali much (I mean why would they? Kali is designed to poke and prod around the network to find vulnerability). Even if you’re using Kali as your primary OS, it just raises eyebrows and you might get a visit from an over-conscious SysAdmin. So we will discuss all possible ways, change the hostname to something else permanently and change hostname randomly in each boot.
By default, my hostname (computer name) is kali as you see in the picture.
1. Open a Terminal (Ctrl+Alt+t) and enter the command “hostname” (without the quotes). This command shows the hostname of our machine.
2. For changing the hostname, we use the same command “hostname” followed by your new desired hostname
command usage :
To view the change in a hostname, open a new terminal
The above command is only applied to the specific session, so when you start the hostname service or restart your computer, the hostname will return to the old one (kali).
3. So, in order to make the hostname change permanent, we should edit the file named located in /etc/hostname (this is where the hostnames are stored).
Use the editor command pico to edit that file. You can use any other editor command as you prefer.
The file opens in the editor for editing.
Delete the entry “kali” (in my machine) and enter your desired hostname.
Press Ctrl+O and hit enter to save and press Ctrl+X to exit.
4. To check whether your hostname has changed or not, you can use the command “service hostname start” which restarts the service “hostname” or simply reboot your kali machine.
5. Now you have your new desired hostname permanent.
Posted by Shubham ;)