Jason Heeris wrote: > Bob Proulx wrote: > > You could still set the hostname randomly. Then later come back and > > write the current hostname to the /etc/hostname file when it is > > writable. > > Later in the rcS sequence, or in rc[2-5]?
I would do it later in runlevel 2 (same as 2-5). Even at the very end would be fine. You could use "Required-Start: $all" if you like. It just needs to happen once and at the very end of the boot should be fine. Then the filesystem is mounted read-write and the file can be updated with the current hostname. Should work fine. Alternatively instead of a random name have you considered using the name it gets from reverse dns lookup of the ip address? Still wondering about the whole random hostname thing. But feel free to ignore my questions here. If you know that is what you want then that is fine with me. Be sure to understand The Birthday Paradox if you go down the path of random hostnames. It surprises people who are not aware of it. > > If you are generating random hostnames then does it actually matter > > what name the current host uses? Would "localhost" be as good as any > > randomly generated one? > > The randomness is needed to avoid name collisions when multiple > devices are running. They offer SSH/SFTP and Samba services over the > network, and need to be available by hostname rather than IP address > (via Avahi and whatever Samba uses, NetBIOS I think). Of course I am sitting here thinking that other hosts use dns to look up the name and to get an ip address. That is independent of the hostname that actually exists on the host at that address. And so the hostname is rather irrelevant. But I see now you mentioning avahi and netbios and some other scruffy protocols that I have never taken the time to understand. So I will stop while I am behind. :-) Bob
signature.asc
Description: Digital signature