[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: domain name (dhcp and chroots)



On Fri, 2012-08-31 at 23:28 -0600, Bob Proulx wrote:
[lots of great stuff]

Thank you for sharing that information.

I think also the hostname sometimes may be set by a dhcp server, right?

Is it possible to set the hostname inside a chroot to something other
than the main system's name?  I tried editing the chroot's /etc/hostname
without effect.  The snipped explanation said /etc/hostname takes effect
because of some init scripts; since they never ran in the chroot that
explains why simply editing that file does not work.

Since hostname is set in the kernel and the chroot shares the kernel
with the host system, it sounds as if they have to have the same name.
Put differently, if I did run the necessary startup script inside the
chroot it would also change the hostname of the host system.  Is that
right?

It may be relevant that the chroot shares key system info with the host.
The host fstab sets things up with
/dev/daisy/chroot	/mnt/chroot	ext3 defaults 0 2
proc-testing		/mnt/chroot/proc proc defaults 0 0
sysfs-testing		/mnt/chroot/sys	 sysfs defaults 0 0
/dev			/mnt/chroot/dev		       rbind defaults,rbind 0 0

I know the sharing is insecure, but things didn't work right inside the
chroot unti I did it.

I care about the chroot hostname mostly for 2 reasons: the prompt
displayed in the shell and the name that appears in syslog.  The former
I could fix by resetting the PS1 environment variable, but I don't know
if there's anything I can do about syslog.

Ross Boylan



Reply to: