On Tue, 14 Feb 2017 12:02:45 +0600 ssmtpmailtesting ssmtpmailtesting <[email protected]> wrote:
> I added: echo myhostname > /proc/sys/kernel/hostname > Still same prompt = root@(none) > But if I install lfs-bootscript, then it changes to root@myhostname. > I also added /etc/fstab and /etc/inittab > > Did I miss anything? AFAIK, bash (if you are running a different shell than bash, let us know) does get the hostname information from the kernel and that that can be set via writing to /proc/sys/kernel/hostname. An instance of bash also sets its variable $HOSTNAME to the hostname it found when it started up. However, do remember that already running instances of bash will need to be restarted *after* the system/kernel hostname is changed for them to see the new name. For example, as root in a bash prompt: echo testhost > /proc/sys/kernel/hostname exec /bin/bash export PS1="[\u@\h]: " should then yield a [root@testhost]: prompt. If not, what does your cat /proc/sys/kernel/hostname say? It should be testhost If you don't have a /proc/sys/kernel/hostname file on system startup, then the kernel may not have proc support and you will either have to enable that feature or set the host name using a utility that calls the sethostname() C-library system call (such as /bin/hostname, from inetutils, as William Harrington suggested). On Tue, 14 Feb 2017 13:16:12 +0100 Michele Bucca <[email protected]> wrote: > try this as root: > echo hostname > /etc/hostname I think the startup scripts grab the host name from /etc/hostname, but he doesn't want to use any startup scripts. AFAIK, bash et al. does not look at /etc/hostname at all. Does anyone know if any common shell or application does look at /etc/hostname? If so, he will indeed have to set that one too. Mike -- http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page Do not top post on this list. A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? http://en.wikipedia.org/wiki/Posting_style
