The quest of generating a new machine id on boot. So I'm back to doing some weird-ass shit. This time my target was the machine id on linux. I mean it's an id, which can potentially identify your machine right? I'm probably wrong here. But what if your machine id was never permanent... Now that's interesting.

First of all, how do you find the machine id file? It's not like linux is gonna store that in registry or something, do you think this os is windows like? Think again! I guess you can find a path to the machine id file with a find command or just by searching with your favourite search engine. Looks like there are 2 paths to the machine id file: /var/lib/dbus/machine-id and /etc/machine-id, and if we want to generate a new machine id, we will need to delete both of them.

Now for generating a new id it's simple: you can use a dbus-uuidgen command with a —ensure option, in order to make sure it's not regenerating the id if the file already exists.

My final script looks like this: rm /etc/machine-id rm -v /var/lib/dbus/machine-id dbus-uuidgen —ensure=/etc/machine-id dbus-uuidgen —ensure

if you want to run this on startup, you will need to get a bit creative and write a systemd service(if you're on systemd). Since I know that not everyone uses systemd I'm not posting the contents of the systemd service file here. feel free to let me know if I should post the systemd service file or host this on gitlab or something.

#privacy #linux