How To Change Domain Name In Kali Linux
Kali Linux is becoming popular and more and more users are using it to try out different things. When installing kali, you get to cull a hostname, but in case y'all accustomed the default hostname (kali) and later want to modify it, here'due south a How to guide to modify hostname in Kali Linux.
Now but changing hostname to something else might not exist enough. How virtually we change hostname every time you kicking your computer to a random one? That could be fun. It likewise helps to avoid suspicion from System Admins in your network to encounter "kali" in their network. Like BackTrack, SysAdmins doesn't like Kali much (I mean why would they? Kali is designed to poke and prod effectually the network to find vulnerability). Even if you're using Kali as your primary Bone, it only raises eyebrows and yous might get a visit from an over-witting SysAdmin. So we will discuss all possible means, change hostname to something else permanently and change hostname randomly in each kick.
- Change hostname permanently and go far glutinous – with reboot
- Alter hostname permanently and brand information technology viscid – without rebooting
- Change hostname randomly in each boot time.
Change hostname permanently – with reboot
As always, I've divided the options into multiple dot points.
Footstep i: edit hostname file
Open hostname file from /etc directory and modify the name in there.
leafpad /etc/hostname
Permit's say nosotros change the name from kali to aiur
Save the file.
Step ii: edit hosts file
Open up hosts file from /etc directory and modify the name in there.
leafpad /etc/hosts
Change kali to aiur.
Salvage the file.
Pace iii: reboot
Now reboot to reflect your changes
reboot
And you should encounter the new hostname
coming up in concluding (i.e. root@aiur
)
Modify hostname permanently – without reboot
Don't want to reboot? Here's how
Follow step 1 and 2 from in a higher place
i.e.
- Update
/etc/hostname
- Update
/etc/hosts
, so local address (es) resolves with the new arrangement name.
Reload configuration files
Type in post-obit 3 commands one at a time.
service hostname.sh starting time service networking force-reload service network-manager force-reload
At present strength-reload networking service.
This volition temporarily disconnect your system from the network (ssh commonly resists short disconnection)
This might definitively disconnect your system from the network because networking might not restore connections; delight reboot, which is non lazy, but ensures that your setup is really right
So we need to reload network-manager service as well.
This should reconnect networking again.
Depending on what other services you lot're running, i.e. avahi
, metasploit
, postgresql
, cups
, openSSH
server, ssmtp
etc. you might have to restart them all.
Now y'all must close your existing terminals to have the new hostname coming up at the acme. See following screenshot with highlighting.
First screenshot is after re-loading all the required services. Notation that it'due south still showing root@kali in the superlative. uname -a
or hostname
shows correct info though.
If I close this terminal and open a new one, root@kali becomes root@aiur which is what nosotros desire.
Modify hostname randomly in each kick fourth dimension
Post-obit process will permit you to change your hostname randomly in each boot. That hostname will stick until y'all reboot again.
Create a fustigate script
Create a script which will automate the procedure
In this terminal create a file.
bear upon newhostname leafpad newhostname
Now, add the following lines to your newly created file:
#!/bin/bash cp -n /etc/hosts{,.erstwhile} idomainname=$(domainname -i) fdomainname=$(domainname -f) newhn=$(cat /dev/urandom | tr -dc 'A-Z' | head -c8) echo $newhn > /etc/hostname mv /etc/hosts /etc/hosts.quondam echo "127.0.0.1 localhost" > /etc/hosts echo "$idomainname $fdomainname $newhn" >> /etc/hosts echo "# The post-obit lines are desirable for IPv6 capable hosts" >> /etc/hosts echo "::one localhost ip6-localhost ip6-loopback" >> /etc/hosts echo "ff02::ane ip6-allnodes" >> /etc/hosts repeat "ff02::ii ip6-allrouters" >> /etc/hosts service hostname.sh cease sleep 1 service hostname.sh start service networking stop sleep i service networking start service network-manager terminate sleep one service network-manager first xhost +$newhn go out
Save it and exit leafpad.
Note: I've used only CAPS here for new hostname, 'A-Z'
. You lot tin also choose a mixure of capital letter and lowercase ('A-Za-z'
) or numbers etc.
Also I've chosen viii characters long hostname head -c8
, you tin modify it to any length you like.
Move script to /usr/bin/ folder
We need to move this file to /usr/bin
.
mv newhostname /usr/bin/newhostname
Brand it executable
Use the following command to make newhostname
file executable.
chmod +x /usr/bin/newhostname
Brand information technology run at Startup:
At present that nosotros accept the script in right identify and information technology'southward executable, we need to add together it your Startup applications. This will let your arrangement to run information technology every time you reboot your machine and generate a new hostname for y'all.
Follow the steps beneath:
- Click on "Applications" –> "System Tools" –> "Preferences" –> "Startup Applications"
- Click "Add"
- Fill in:
- Name: Random Host Name
- Command:
/usr/bin/newhostname
- Comment: Start Kali with a random hostname each boot
- Click Save
- Close Windows
Reboot
Finally reboot your machine to load the script at start-up.
reboot
Bask your new hostnames
. Here's mine
Credits and sources:
Similar procedures were posted in different places:
- Telecomix Wiki
- Ubuntu Forums by rocksockdoc
- Kali forums by testingresults, ,
- Notesbit past Jiltin
Thank you for reading. Please share with others.
How To Change Domain Name In Kali Linux,
Source: https://www.blackmoreops.com/2013/12/12/change-hostname-kali-linux/
Posted by: smithprame1944.blogspot.com
0 Response to "How To Change Domain Name In Kali Linux"
Post a Comment