So I'm using DefaultZero's method to generate a random mac:
Code:
vi /etc/init.d/macc.sh
***
Code:
#!/bin/bash
ifconfig wlan0 down
macchanger -r wlan0
ifconfig wlan0 up
***
Code:
chmod +x /etc/init.d/macc.sh
Code:
update-rc.d macc.sh defaults 100
and I've replaced the starred code with RepZeroWorld's code:
Code:
#!/bin/bash
ifconfig wlan0 down
random_mac=`macchanger -r wlan0|sed -n 's/^New *MAC: \([[:alnum:]].*[[:alnum:]]\) .*/\1/gp'`;
find /etc/NetworkManager/system-connections -type f -exec sh -c "sed -i \"/^cloned-mac-address.*/d;/^\[802-11-wireless\]/a\cloned-mac-address=$random_mac\" \"{}\"" \;
Everything seems fine, I reboot to activate it and the mac does not change. I try to do it manually by:
Code:
cd /etc/init.d/
sh macc.sh
and it returns
find: missing argument to `-exec'
The only change I've made it the 'wlan0' to 'wlan1' to match my device.
Am I just missing something really obvious?
If no one can find a problem with what I've done there ^ I'll screenshot the file when I'm back at my laptop.
Thanks
EDIT:
Ugh, I was missing two spaces:
Code:
-exec sh -c "sed -i \"/^cloned-mac-address.*/d;/^\[802-11-wireless\]/a\cloned-mac-address=$random_mac\"\"{}\""\;
Feel free to close, I apologise for being blind