Linux ID

本文介绍了在Linux中用于识别硬件和软件的各种唯一标识符,包括主板UUID、CPU UUID、MAC地址、USB设备序列号、启动ID、主机名、IP地址、D-Bus机器ID等。强调了这些ID的适用场景、限制及其不可靠性,并推荐使用/var/lib/dbus/machine-id作为识别特定Linux/Unix安装的首选方法。
摘要由CSDN通过智能技术生成

原文: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
  1. /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.
  2. 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.
  3. /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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值