Hi, i tried to do this script:
Generate a "unique" 6-digit hexadecimal identifier for your computer. Do not use the flawed hostid command. Hint: md5sum /etc/passwd, then select the first 6 digits of output.
And it won't change until the passwd file does. I agree, this isn't a very random way to get a unique system id, especially since /etc/passwd doesn't contain passwords! Base installs of the same OS will be identical.
dd if=/dev/urandom count=256 bs=1 2>/dev/null | md5sum should be more random.
I must be misunderstanding what you're trying to do. The concept of a unique ID for a computer would seem to be something that would be constant for the life of that piece of hardware and different from any other computer on the planet. Anything based on /etc/passwd fails on both counts. Furthermore, is 16**6 different possible values sufficient for identifying a unique ID in the set of computers?
If you're looking for something unique and constant, you would usually use something like serial #, model #, and manufacturer in toto; not some 6 character subset of that data.