原文:http://0pointer.de/blog/projects/ids.html
When programming software that cooperates with software running on behalf ofother users, other sessions or other computers it is often necessary to work withunique identifiers. These can be bound to various hardware and software objectsas well as lifetimes. Often, when people look for such an ID to use they pickthe wrong one because semantics and lifetime or the IDs are not clear. Here's alittle incomprehensive list of IDs accessible on Linux and how you should orshould not use them.
Hardware IDs
- /sys/class/dmi/id/product_uuid: The main board product UUID, asset by the board manufacturer and encoded in the BIOS DMI information. It maybe used to identify a mainboard and only the mainboard. It changes when theuser replaces the main board. Also, often enough BIOS manufacturers write bogusserials into it. In addition, it is x86-specific. Access for unprivileged usersis forbidden. Hence it is of little general use.
- CPUID/EAX=3 CPU serial number: A CPU UUID, as set by theCPU manufacturer and encoded on the CPU chip. It may be used to identify a CPUand only a CPU. It changes when the user replaces the CPU. Also, most modernCPUs don't implement this feature anymore, and older computers tend to disablethis option by default, controllable via a BIOS Setup option. In addition, itis x86-specific. Hence this too is of little general use.
- /sys/class/net/*/address: One or more network MAC addresses, asset by the network adapter manufacturer and encoded on some network cardEEPROM. It changes when the user replaces the network card. Since network cardsare opti