I have recently pieced together a script with my limited knowledge of bash that is supposed to do 2 things:
- It is supposed to change my hostname
- and then change my mac address.
I put the instructions directly into
/etc/rc.local on my backtrack 5 r3 machine, but I can't seem to get it to change my mac address. macchanger is already installed. It changes my hostname fine, but it doesn't seem to want to change my mac address. Could this be because my machine is running in virtual box?
Here is what I put into
dhclient -r && rm -f /var/lib/dhcp3/dhclient* && sed "s=$(hostname)=REPLACEME=g" -i /etc/hosts && hostname "$(echo $RANDOM | md5sum | cut -c 1-7 | tr a-z A-Z)" && sed "s=REPLACEME=$(hostname)=g" -i /etc/hosts && macchanger -e eth0 && macchanger -e wlan0 && dhclient
I tried it like this, with the && operators, and I also tried it by putting a command on each line. The hostname changes each time but the MAC address doesn't.
Any help would be appreciated!