How can I get CPU serial number under Linux (Ubuntu) without root permissions?
I tried cpuid command, it works without root permissions, but appears to return all zeros (I believe because something needs to be changed in BIOS).
Can you please suggest me another way to retrieve CPU serial from a program without root permissions and without having to modify BIOS?
Processor serial numbers were basically only in Pentium III processors. Intel removed it from later models due to the privacy concerns that were raised. As such, unless you're on a PIII AND your BIOS settings let you read the serial number, all you'll get are 0's.
Root permissions required. The answer is dmidecode.
If you need CPU ID:
dmidecode | grep -w ID | sed "s/^.ID\: //g"
This will get CPU ID, remove 'ID: ' from output
If you need to receive a computer ID:
dmidecode | grep -w UUID | sed "s/^.UUID\: //g"
If you wish to get kernel uuid without root permissions, then:
dmesg | grep UUID | grep "Kernel" | sed "s/.*UUID=//g" | sed "s/\ ro\ quiet.*//g"
It's because of recent comment. Happened long time ago, so can't explain now why these ID were taken as machine identifier. Got actual Processor ID fromn Processor Information
section. Extracted on Debian OS.
pr=0; dmidecode | while read line; do [ "$line" == "Processor Information" ] && pr=1; [ $pr -eq 0 ] && continue; [ -n "$(echo $line | grep '^ID')" ] && echo $line | awk -F"ID: " '{print $2}' && break; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With