Changing MAC address of USB LAN adapter permamently

It’s been long time since the last post… But time came that I’ve faced serious problem when trying to change MAC address of my USB LAN adapter.

As recommended by numerous pages found by googling change MAC address Linux, I’ve tried ifconfig eth0 hw ether NEWMAC and macchanger. It changed MAC of my devices (as seen in ifconfig output), yet after plugging the LAN cable, the MAC was automatically restored to permanent one.

At first, I thought it’s the fault of NetworkManager, so I’ve stopped it. But the problem still persisted. After some tinkering, I’ve realised, the MAC can be specified also in NetworkManager alone by adding to /etc/NetworkManager/NetworkManager.conf two lines:

[connection]
ethernet.cloned-mac-address=NEWMAC

and restarting NetworkManager

sudo service network-manager restart

Note, when I’ve changed MAC in NetworkManager using GUI, the permanent MAC was also restored upon LAN cable connection.

Hope this helps someone having similar problem with USB LAN adapter.

Batch conversion of images using ImageMagic

Today I needed to convert multiple .pdf files into .tiff images with specific DPI and LZW compression. I found it’s very simple using ImageMagic.

# install
sudo apt-get install imagemagick

# convert .pdf to lzw compressed .tiff changing dpi to 300
mkdir tiffs
for f in *.pdf; do 
  echo `date` $f; 
  convert -density 300 -compress lzw $f tiffs/$f.tiff; 
done
date

For more options, have a look at ImageMagic site.