Linux System Administration

In some situations you need to fake / change / spoof a MAC address of your network interface. macchanger Linux command does this job in no time. With this tool you can change your mac address of any Ethernet network device wired or wireless.
Here is a small example:

My original mac address:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:16:d3:23:7c:f7
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:ee000000-ee020000

Turn off your network interface:

# ifconfig eth0 down

Use macchanger to randomly generate new MAC address and assign it to eth0 network interface:

# macchanger -r eth0
Current MAC: 00:16:d3:23:7c:f7 (unknown)
Faked MAC:   32:cf:cb:6c:63:cd (unknown)

In case you see a following error message:

ERROR: Can't change MAC: interface up or not permission: Cannot assign requested address

Make sure that your interface is down and you are running macchanger as a root user.
Enable eth0 network interface and check new MAC address:

# ifconfig eth0 up
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 32:cf:cb:6c:63:cd
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:ee000000-ee020000

If for example a specific MAC address is required use macchanger as follows:

# macchanger -m b2:aa:0e:56:ed:f7 eth0
Current MAC: 32:cf:cb:6c:63:cd (unknown)
Faked MAC:   b2:aa:0e:56:ed:f7 (unknown)

macchanger also allows you to change mac address for a specific network card vendor. Use a -l option to print a list of all know network card vendors.

Every process running on the linux system has a default priority assigned which tells the the system how much processing power should be dedicated to each particular process. It is possible to change this priority value with nice or renice command. Here is a small example: Let's say that we have a very simple bash script which prints date and time to the file 1000 times.

#!/bin/bash
for i in $(seq 1 1000); do date >> date.txt;sleep 1; done

Save this script and make it executable with chmod command. Execute the script:

$ nice -n 00 ./date &

By executing a ./date script with nice -19 command we gave the date.sh very high priority as the priority range is from -20 ( higest ) to 19 ( lowest ). to confirm the priority run ps -l command from the same terminal.

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S  1000  3670  2940  0  80   0 -  1196 -      pts/2    00:00:00 bash
0 S  1000  6665  3670  0  90  10 -  1111 -      pts/2    00:00:00 date.sh
0 S  1000  6697  6665  0  90  10 -   754 -      pts/2    00:00:00 sleep

as you can see date command and sleep command has same priority 10. However sleep running inside a date.sh is a child process of date.sh and date.sh is a parent process of sleep. At this stage we can try to change the priority to some other value with renice command and with use a PID ( Process Identification Number ):

$ renice 15 -p 6655
6665: old priority 10, new priority 15

The command above will change nice value from 10 to 15. to confirm priority value:

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S  1000  3670  2940  0  80   0 -  1198 -      pts/2    00:00:00 bash
0 S  1000  6665  3670  0  95  15 -  1113 -      pts/2    00:00:00 date.sh
0 S  1000  7109  6665  0  95  15 -   754 -      pts/2    00:00:00 sleep

NOTE: With a non-super user account you can change priorities only for the processes you own, assign priorities only in range of 0 - 19 and you can only increase a nice value. root user can change any process to any priority nice value. Another way to change priority values is to use top command and r key.

The following bash script allows user to check for domain name availability using a whois utility ( Domain hijacking made easy ). User needs to only supply single or multiple keywords and the script checks domain availability for each keyword+domain-label. See below for a sample output.

Please feel free to add more generic domain labels into the list. However, test your whois server on what it returns if domain is available as not all whois servers return the exact string. I have tested only domains which are currently in the bash script below. When you get a string which your whois server returns when domain name is available, add it to the script's grep line starting with prefix"|". The chances are that if you add new domain name label the script will just work, but if not you know what to do.

Insert following lines into a file called check-domain-availability.sh

Read more...


Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top