Change your hostname randomly in Ubuntu

The following script worked great:

#!/bin/bash

#random_computer_name

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

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

randnum

function randpass
{
newhostname=`
}

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

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 )

Facebook photo

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

Connecting to %s