photo lineviral_1.png

How To Modify Hostname Inward Kali Linux?

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike things. When installing kali, you lot larn to guide a hostname, but inwards illustration you lot accepted the default hostname (kali) as well as afterward desire to alter it, here’s a How to guide to alter hostname inwards Kali Linux.


Now merely changing hostname to something else mightiness non survive enough. How well-nigh nosotros alter hostname every fourth dimension you lot boot your figurer to a random one? That could survive fun. It every bit good helps to avoid suspicion from System Admins inwards your network to come across “kali” inwards their network. Like BackTrack, SysAdmins doesn’t similar Kali much (I hateful why would they? Kali is designed to poke as well as prod unopen to the network to respect vulnerability). Even if you’re using Kali every bit your primary OS, it merely raises eyebrows as well as you lot mightiness larn a catch from an over-conscious SysAdmin. So nosotros volition hash out all possible ways, alter hostname to something else permanently as well as alter hostname randomly inwards each boot.



  1. Change hostname permanently as well as larn into gummy – alongside reboot

  2. Change hostname permanently as well as larn into gummy  – without rebooting

  3. Change hostname randomly inwards each boot time.


Change hostname permanently – alongside reboot


As always, I’ve divided the options into multiple dot points.


Step 1: edit hostname file


Open hostname file from /etc directory as well as modify the advert inwards there.


leafpad /etc/hostname

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Let’s order nosotros alter the advert from kali to aiur


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Save the file.


Step 2: edit hosts file


Open hosts file from /etc directory as well as modify the advert inwards there.


leafpad /etc/hosts

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Change kali to aiur.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Save the file.


Step 3: reboot


Now reboot to reverberate your changes


reboot

And you lot should come across the novel hostname coming upward inwards final (i.e. root@aiur)


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Change hostname permanently – without reboot


Don’t desire to reboot?  Here’s how


Follow footstep 1 as well as 2 from above


i.e.



  1. Update /etc/hostname

  2. Update /etc/hosts, as well as hence local address (es) resolves alongside the novel arrangement name.


Reload configuration files


Type inwards next iii commands i at a time.


service hostname.sh start
service networking force-reload
service network-manager force-reload

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Now force-reload networking service.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


This volition temporarily disconnect your arrangement from the network (ssh unremarkably resists curt disconnection)


This mightiness definitively disconnect your arrangement from the network because networking mightiness non restore connections; delight reboot, which is non lazy, but ensures that your setup is actually correct


 


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


So nosotros necessitate to reload network-manager service every bit well.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


This should reconnect networking again.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Depending on what other services you’re running, i.e. avahi, metasploit, postgresql, cups, openSSH server, ssmtp etc. you lot mightiness own got to restart them all.


Now you lot must unopen your existing terminals to own got the novel hostname coming upward at the top. See next screenshot alongside highlighting.


First screenshot is after re-loading all the required services. Note that it’s yet showing root@kali inwards the top. uname -a or hostname shows right information though.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


If I unopen this final as well as opened upward a novel one, root@kali becomes root@aiur which is what nosotros want.


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Change hostname randomly inwards each boot time


Following physical care for volition allow you lot to alter your hostname randomly inwards each boot. That hostname volition stick until you lot reboot again.


 


Create a bash script


Create a script which volition automate the procedure


In this final practice a file.


touch newhostname
leafpad newhostname

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Now, add together the next lines to your newly created file:


#!/bin/bash
cp -n /etc/hosts{,.old}
idomainname=$(domainname -i)
fdomainname=$(domainname -f)
newhn=$(cat /dev/urandom | tr -dc 'A-Z' | caput -c8)
echo $newhn > /etc/hostname
mv /etc/hosts /etc/hosts.old
echo "127.0.0.1 localhost" > /etc/hosts
echo "$idomainname $fdomainname $newhn" >> /etc/hosts
echo "# The next lines are desirable for IPv6 capable hosts" >> /etc/hosts
echo "::1 localhost ip6-localhost ip6-loopback" >> /etc/hosts
echo "ff02::1 ip6-allnodes" >> /etc/hosts
echo "ff02::2 ip6-allrouters" >> /etc/hosts
service hostname.sh stop
sleep 1
service hostname.sh start
service networking stop
sleep 1
service networking start
service network-manager stop
sleep 1
service network-manager start
xhost +$newhn
exit

Save it as well as boot the bucket leafpad.


Note: I’ve used solely CAPS hither for novel hostname, 'A-Z'. You tin dismiss every bit good guide a mixure of working capital missive of the alphabet as well as lowercase ('A-Za-z') or numbers etc.


Also I’ve chosen 8 characters long hostname head -c8, you lot tin dismiss alter it to whatsoever length you lot like.


Move script to /usr/bin/ folder


We necessitate to motion this file to /usr/bin.


mv newhostname /usr/bin/newhostname

Make it executable


Use the next ascendency to brand newhostname file executable.


chmod +x /usr/bin/newhostname

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Make it run at Startup:


Now that nosotros own got the script inwards right house as well as it’s executable, nosotros necessitate to add together it your Startup applications. This volition allow your arrangement to run it every fourth dimension you lot reboot your machine as well as generate a novel hostname for you.

Follow the steps below:



  1. Click on “Applications” –> “System Tools” –> “Preferences” –> “Startup Applications”

  2. Click “Add”

  3. Fill in:

    1. Name: Random Host Name

    2. Command: /usr/bin/newhostname

    3. Comment: Start Kali alongside a random hostname each boot



  4. Click Save

  5. Close Windows


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


 


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Reboot


Finally reboot your machine to charge the script at start-up.


reboot

Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Enjoy your novel hostnames. Here’s mine


 


Kali Linux is becoming pop as well as to a greater extent than as well as to a greater extent than users are using it to endeavour out unlike t How to alter hostname inwards Kali Linux?


Credits as well as sources:


Similar procedures were posted inwards unlike places:



  1. Telecomix Wiki

  2. Ubuntu Forums past times rocksockdoc

  3. Kali forums past times testingresults, ,

  4. Notesbit past times Jiltin


Thanks for reading. Please portion alongside others.


Buat lebih berguna, kongsi:
close