-
-
Save Happyholic1203/0705198e2a288d0663d43709fa0b3816 to your computer and use it in GitHub Desktop.
Unique id for a linux system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat /var/lib/dbus/machine-id && exit | |
# Provided by dbus, hence available on all systemd systems. | |
# Any user can read it and it is persistent accross boots. | |
# It is unique per installation, and works well in VMs. | |
# Not all systems (i.e. stage3 gentoo/handbook install) | |
# have dbus installed by default. | |
cat /sys/class/dmi/id/product_uuid && exit | |
# Which should be the same as | |
# dmidecode -s system-uuid | |
# Requires root | |
# Persistent accross re-installs | |
# Depends on x86 hardware | |
# Not available on all kernels, may be module dependent. | |
# Lennert Poettering has a good analysis | |
# http://0pointer.de/blog/projects/ids.html | |
# FreeBSD has | |
sysctl kern.hostuuid | |
# Which is persistent accross reboots |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment