Subject: Re: localtime and chroot issues
To: Ian Zagorskih <>
From: Klaus Klein <>
List: tech-kern
Date: 05/04/2004 14:36:50
On Tuesday 04 May 2004 14:14, Ian Zagorskih wrote:

[moved to tech-userlevel]

> Doing some transfers with TFTP and debugging some dummy 3d party TFTP client
> i fould quite an "odd" syslog behaviour: all tftpd records in syslog were in
> GMT rather in system's localtime (GMT+7). After a little research i found,
> that tftpd daemon runs as chroot-ed process in default /tftproot dir so of
> course it couldn't access /etc/localtime to get the proper timezone
> information. Ok, i made a copy of localtime in tftpd's sandbox so it feels
> happy now.

This could also be worked around by issuing tzset() prior to
chroot()ing the tftpd process, possibly by doing so in tftpd, or
in openlog().

> 2. Such trick when i have to make mirrowing of localtime [and others] file
> system variables can lead to the problem when i have a lot of chroot boxes.
> During server's re-configuration i can easily forget to update for example
> localtime of some chrooted client. On the other hand, such thing as time
> zone information is system wide so maybe it would be reasonable to move it
> in sysctl like "kern.localtime" so i could setup this info in sysctl.conf
> and have it accessible system wide regadrless to the current root path ?

There's some prior art for providing the local domain log socket to
chroot()ed processes; see /etc/rc.d/syslogd.  Something similar could
be used to provide /etc/localtime, but I don't think either would be
a desirable thing to have below /tftpboot.

- Klaus