[Tfug] Looking for a unique identifier

Brian Murphy murphy at coppershadow.com
Thu Aug 2 12:34:18 MST 2007


jblais wrote:
> I've used the Winders GUID that uniquely identifies a winders installation,
> to know what machine is running an application.
 >
> Does Linux have anything like that?

No.

> I was thinking of using the MAC address.  I can get it through system calls
> like ifconfig, but is there an "easy" way of getting it with C code?
> 
> Is there a more unique, or easier to get string or number that can identify
> a particular machine that an app might be running on?


MAC of eth0 is about the best you'll get.  In C, request the 
SIOCGIFHWADDR ioctl of a socket to get the MAC.

Note that ifconfig can change the hw address of an interface.

Brian




More information about the tfug mailing list