summaryrefslogtreecommitdiff
path: root/nonprism/hostname-blanker/hostname-blanker.sh
blob: c19d60eb3f88c09a3e64aee1abf6f8c043711cb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# This script wipes hostname so that DHCP can't send it over the network
#hostnamectl set-hostname localhost
sed -i '/dhcp=/c\dhcp=dhclient' /etc/NetworkManager/NetworkManager.conf
echo "localhost" > /etc/hostname
wait
sed -i '/127.0.0.1/c\127.0.0.1       localhost.localdomain   localhost 'localhost'' /etc/hosts  ##properly sets our new host in /etc/hosts file
wait
sysctl kernel.hostname=localhost
wait
hostname localhost ##avoids need to reboot before showing our new hostname in terminals etc.
wait