Score:1

Trying to change Mac address with MACCHANGER upon every restart, does not work

gb flag

Im new to Linux!

I want to change my MAC Address automatically every boot up, the issue is I cannot follow the already existing tutorials on this since my system does not work with those.

Online tutorials state use this:

macchanger -r wlp8s0

That does not work for me, this is the procedure that works for me by doing manually:

sudo ifconfig wlp8s0 down
sudo macchanger -p
sudo macchanger -r wlp8s0

The issue is I dont want to do this manually everytime. So please help me automate this. From my research they say I should use sudo crontab -e, this is what I have on the bottom of that file:

sudo ifconfig wlp8s0 down
sudo macchanger -p
sudo macchanger -r wlp8s0

That does not work, I have also tried creating a file in cron.d and putting the following in there :

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot /sbin/ifconfig wlp8s0 down
@reboot root macchanger -p
@reboot root macchanger "-r wlp8s0"

This does not work either. Please help me!

in flag
[This answer](https://askubuntu.com/a/976481/1222991) may offer a cleaner solution
Score:0
in flag

I just happened to peek at Your thread whilst browsing threads, and haven't dug up my forum login credentials... so don't look to me for more thorough engagement than this (I'm certain others can help You further).

Your Cron-file's directives looks a bit errant/iffy for starters ("root" for instance (not "sudo -u root?), but I could certainly be wrong).

Secondly, I believe You need to set the "executable" flag on the file ('chmod ...'), and possibly/probably use 'chown' to "give the file to" the root account, or Cron or other appropriate account with the permissions).

Honestly, I think You should look at how to create a system startup script instead, especially since that's the closest to what You want done (something-something at_startup.

For that, look into the RC.s system (in [/etc/RC.s] directory, or something like that.

Ask around here if You need help with that, there are definitely others here with the know-how. Good luck!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.