Issues w/ timezones on gssftpd

Tom Yu tlyu at MIT.EDU
Tue Nov 28 01:33:35 EST 2006

>>>>> "Philip" == Philip Prindeville <philipp at> writes:

Philip> As for why not copy the /etc/localtime file? Because some
Philip> people do some odd things, such as setting TZ in startup
Philip> scripts, wrappers, etc. before firing up ftpd. In that case,
Philip> if the copy of /etc/localtime in the chroot() environment
Philip> (such as /var/ftp) disagrees with the contents of "TZ", then
Philip> you're going to get unexpected and possibly undefined
Philip> behavior.

It's possible that, in addition to copying /etc/localtime, you may
have to copy the entire contents of /usr/share/lib/zoneinfo or
whatever the relevant set of database files is.  (assuming someone has
set TZ to a value which causes lookups in the timezone database) I
think POSIX also defines the value of TZ to override
implementation-defined behavior, unless the value of TZ begins with a
":" character.

Philip> Calling tzset() before calling ctime()/localtime()/strftime()
Philip> *or* chroot() is the simplest solution that offers consistent
Philip> behavior in all scenarios.

I think it would be more correct to configure the chroot environment
so that the OS can correctly handle the timezone.  POSIX says that
ctime(), localtime(), and strftime() behave as if they called tzset()
first.  I also seem to recall seeing your ftpd logging some messages
using the correct timezone.  This strongly suggests that you need to
correctly configure the chroot environment with timezone database

Have you tried copying /etc/localtime and the timezone database files
into the correct places in the chroot directory?


More information about the krbdev mailing list