Elmi
Elmi

Reputation: 6213

Get unique identifier of a system (not the MAC-address)?

I need to get a unique identifier of a Linux system that does not change when the system is rebooted (but may change when the user replaces nameable amounts of the hardware or formats harddisk).

Following solutions are NOT possible:

So...any other idea how a system could be identified uniquely?

Upvotes: 3

Views: 711

Answers (2)

HariZoldyck
HariZoldyck

Reputation: 11

Machine ID can be used. It is a unique identifier for local system, and it is set during installation or the first system boot of OS. It can even persist upon reboots. So, it is reliable for your scenario to use it as unique identifier of a Linux device. For more info - link

cat /etc/machine-id

Upvotes: 1

user590028
user590028

Reputation: 11728

I think the answer to your question will depend on what you consider to be a "permanent" part of the system. Let's assume you decide that the hard drive partitions are semi-permanent from your applications perspective, then calculate some sort of hash of the contents of /proc/partitions.

That's something like:

#!/bin/sh
</proc/partitions sha1sum|cut "-d " -f1

Upvotes: 2

Related Questions