sudo apt-get install coreutils
cat /etc/hosts
192.168.0.209 localhost.localdomain localhost
ubuntu 下安装的hostid 命令并不能作为唯一认证码,hostid很可能是主机的IP地址经过转换得到,例如主机IP地址为192.168.0.209,那么可能得到了hostid就是 a8c0d100。
192.168.0.209 --> 168.192.209.0 --> a8.c0.d1.00–> a8c0d100
通过cpu的ID作为唯一认证码较为可靠。
z@localhost:~$ cat /proc/cpuinfo
Processor : AArch64 Processor rev 4 (aarch64)
processor : 0
processor : 1
processor : 2
processor : 3
Features : fp asimd aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: AArch64
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
Hardware : sun50iw6
Serial : 9c0001400c0164911f50
获取cpu id命令
z@localhost:~$ cat /proc/cpuinfo | grep Serial | awk -F ':' {'print $2'}
9c0001400c0164911f50