1

In my crontab I have:

@reboot macchanger -r eth0

(changed on my root user). But the MAC address is not changing when I reboot. macchanger -r eth0 works fine in the terminal.

1

Commands have to be prefixed with the directory name and parameters have to be enclosed in double quotes. Assuming your macchanger resides in the regular path, create a file (with any name) in the /etc/cron.d directory containing:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot root sleep 15
@reboot root macchanger "-r eth0"
| improve this answer | |
  • Does the file name matter? – Alfie Dec 21 '16 at 19:55
  • The important thing is it's in the directory /etc/cron.d you can call the file anything you like. You need to create / edit it with sudo powers though. – WinEunuuchs2Unix Dec 21 '16 at 20:00
  • @Alfie please note I've changed the command line by adding root in the middle. – WinEunuuchs2Unix Dec 21 '16 at 22:24
  • I still can't get it to work, does everything look as it should here: (thanks a lot :) ) !Screenshot – Alfie Dec 22 '16 at 21:52
  • Your screenshot looks perfect. Could it be the network isn't even up when cron starts? Would it be better putting macchanger into startup applications? The other option is putting sleep 15 in front of macchanger line, I'll add that to the answer. – WinEunuuchs2Unix Dec 22 '16 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.