A complete invisibility – anonymity – solution for Ubuntu

Based on some online articles and my previous posts, I created the following script which does the following:

  1. Generates and assigns a random MAC address to my wired card (eth0) and wireless card (wlan0) using the macchanger software described here
  2. Generates and assigns a new hostname to my OS
  3. Applies the new changes in my “/etc/hosts” file
  4. Runs on every startup

IMPORTANT: You MUST have your “” and “” entries as the last two lines if you need to run this script EXACTLY as it is. If you don’t want this, you can simply change the “sed” part.

Here is the script:


#random_computer_name & random MAC address for both eth0 and wlan0

sudo macchanger -A eth0 #random mac for eth0
sudo macchanger -A wlan0 #random mac for wlan0

sed -i 1,10d /etc/hostname

function randnum
number=$[ ( $RANDOM % 15 ) + 8 ]


function randpass


(echo ‘0a’; echo $newhostname; echo ‘.’; echo ‘wq’) | ed -s /etc/hostname

/bin/hostname $newhostname

sed -i ‘$d’ /etc/hosts # deletes the last two lines in /etc/hosts
sed -i ‘$d’ /etc/hosts

echo -e “    $newhostname localhost\n127.0.1.1    $newhostname” >>/etc/hosts

You can add the above file to your startup following the steps in this link

Appreciate any feedback. Note: I’m already working with this script on my laptop and it’s working fine till now, I just had about 10 seconds idle at the startup screen.

Update: That delay happened only after the first startup and then disappeared

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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