Change your hostname randomly in Ubuntu

The following script worked great:



sudo sed -i 1,10d /etc/hostname

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


function randpass


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

sudo /bin/hostname $newhostname

Just add the above script in a file and execute it with “sudo”.

To add this file to your startup scripts, just follow the instructions in this post

Source: here


About SoCRaT

Research Support and Infrastructure 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: Logo

You are commenting using your 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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s