On Fri, 24 Sep 2010 16:59:30 +0000 (UTC), Y Knot wrote:
>
> However, on Linux, while I can change these things manually, I have not
> yet found software that does so automatically upon every reboot.
>
For about 99.99% of the time, whatever you can do manually, you can
put the commands in a script to do the same thing.
> The question is where can I find software that will perform that task of
> changing the wireless card MAC address and PC hostname upon every reboot?
If you look in /etc/init.d you will see several scripts which execute
during system startup/shutdown.
If you look in /etc you will see several directories which contain
links back to /etc/init.d scripts. Do a
ls /etc/rc?.d
Now look in a directory, with
ls -l /etc/rc2.d/*
Those S* links are the order they
execute during Startup and the K* are the links executed in that order
during kill/shutdown.
If you were to do the command
runlevel
you would see what level you are running and can look in that
directory to see what executes when.
If you do a
$ runlevel
N 2
the your runlevel is 2. So, do a
ls -l /etc/rc2.d/*
I your case you might try creating a /etc/init.d/rnd_hostname
then create a /etc/rc2.d/S05rnd_hostname link pointing to
/etc/init.d/rnd_hostname.
Next boot, S05rnd_hostname would run your script to change host name.
Going to guess you are running ubuntu. It runs dhclient which gets
your ip address and whatnot to connect to the internet.
Doing a man dhclient eventually suggests doing a
man dhclient_script
which can lead to the fact that you can create a
/etc/dhcp3/dhclient-exit-hooks script. That is where I would try to
put code to munge your MAC address.
You might want to bookmark this url
http://tldp.org/LDP/abs/html/index.html
You could create /etc/dhcp3/dhclient-exit-hooks with
echo $@ > /tmp/hooks
env >> /tmp/hooks
Set execute permission with
chmod +x /etc/dhcp3/dhclient-exit-hooks
After booting, look at /tmp/hooks to see what information is available
for your code.
Now, delete /tmp/hooks and restart the network and see what you have.
rm /tmp/hooks
service network-manager restart
cat /tmp/hooks
All the above needs to done from a root terminal. To get to a root terminal:
sudo -i
when through with root terminal, enter the command exit or do a control d
--
The warranty and liability expired as you read this message.
If the above breaks your system, it's yours and you keep both pieces.
Practice safe computing. Backup the file before you change it.
Do a, man command_here or cat command_here, before using it.