Remix.run Logo
purplehat_ a day ago

Here's an equivalent little script for Debian Linux (but should work on most distros), based on classhasclass's comment:

  NEW_MAC=$(printf '02:%02x:%02x:%02x:%02x:%02x\n' $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)))

  sudo ip link set wlan0 down

  sudo ip link set wlan0 address "$NEW_MAC"

  sudo ip link set wlan0 up
You should replace `wlan0` with whatever you see in `ip link show` for your wireless interface, for me it is `wlp0s20f3`. I replaced the `openssl rand` command because it was generating some invalid MACs; this is hopefully only valid ones.
righthand a day ago | parent [-]

KDE Plasma has a “Random” button next to the MAC address field in the Network Manager UI. I’m on Debian Testing so not sure when it was added.