On Windows and MacOSX it is trivial to retrieve some kind of UUID per machine:
On Windows (regedit):
"Software\Microsoft\Cryptography\MachineGuid"
On MacOSX
$ ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID
However on Linux this is much more complex. So far I have found the following:
On dbus based system:
$ cat /var/lib/dbus/machine-id
On x86 based system (requires root power):
$ sudo cat /sys/devices/virtual/dmi/id/product_uuid
On PowerPC based system:
$ cat /proc/device-tree/serial-number
What's really odd, is that UUID for the main board on x86-based arch is restricted to root user, but can be accessed using regular user via hal ($ lshal | grep 'system\.hardware\.serial'
). While at the same time, all disk UUIDs can be accessed ($ ls /dev/disk/by-uuid/
) and serial number can be accessed from any user on PowerPC-based arch.
So is there any portable UUID I can use on Linux ? dbus may or may not be installed, I need to read this value from a non-root user, and it needs to remains the same across reboot (/proc/sys/kernel/random/boot_id
is therefore not an option).