How to Automatically Set the Hostname of a Workstation to the Machine's Serial Number
How to automatically set the hostname of a workstation to the machines serial number for SLED 10.
This is very handy if you are rolling out SLED 10 within your company and want to have a naming standard for all of your workstations. By setting the hostname to the serial number of the machine you are also making it easier for the help desk to identify what machine a particular person is calling in about.
Login as root and from the console type:
dmidecode | grep “Serial Number” | head -n1 | sed -e ‘s/\tSerial Number: //g’ > /etc/HOSTNAME
Note: For SUSE 10 (not SLED 10) type:
dmidecode | grep “Serial Number” | head -n1 | sed -e ‘s/\t\tSerial Number: //g’ > /etc/HOSTNAME
The next time the workstation is rebooted, the hostname will now be the serial number.