An FTP client uploads a file to a pure-ftpd server. The client is not attempting to set a time stamp on the file, so it should receive the current time stamp of the FTP server system. However, after uploading the time, the FTP client does a directory list and sees that the time is off by a certain number of hours.
Viewed from a normal shell on the Linux server, the time stamp is correct.
The time stamp is off by the FTP server system's GMT offset, i.e. the difference between local time and Greenwich Mean Time.
Pure-ftpd would normally display time stamps in directory lists in the server's local time. However, to do this, within the given FTP session, operating as the logged-in user, it must be able to read the /etc/localtime file. This will not be possible if the user is chrooted. A chrooted user is one who is placed in his or her home directory, and that is presented to them as a root (/) directory. They cannot navigate or access anything outside of their home directory.
The anonymous user is always chrooted. Other users might be, depending on the pure-ftpd configuration.
It is not necessarily bad to display time stamps in GMT. Many administrators prefer this. However, if this is not desired, the display can be returned to local time by one of the following methods. These are listed in order of ease / preference (although that is somewhat subjective):
Solution 1. If an update to pure-ftpd-1.0.22 or higher is available, update that package. The newer version resolves this issue. As of the current revision of this document, SLE 10 SP3 systems can obtain that version through Online Updates.
Solution 2. If an update to pure-ftpd 1.0.22 is not available for the platform, add a timezone (TZ) variable to the startup script /etc/init.d/pure-ftpd. For example, edit that script and find the section:
case "$1" in
After "start)" insert a new line to define the time zone. For example, for Mountain Standard Time, which is 7 hours off of GMT, and if Mountain Daylight time is also observed in the area, the line would be:
TZ="MST7MDT" ; export TZ
For more information on various ways of using time zone syntax, see: man timezone
Solution 3. Strategically place a copy of the file /etc/localtime within the user's home directory. For example, for the anonymous user (whose home directory is /srv/ftp), these steps would be executed as root:
cp /etc/localtime /srv/ftp/etc/localtime
This way, even when the FTP session is chrooted, pure-ftpd will find an /etc/localtime file. There is no need to restart pure-ftpd, because each individual FTP session makes it's own attempt to read the file.
If the users' home directories are in the same file system as /etc, then another option is to create a hard link to the file. For example, instead of the 'cp' command above, the following could be used:
ln /etc/localtime /srv/ftp/etc/localtime
This cp or ln solution would need to be implemented in all chrooted user's home directories.
If the users home directory is not in the same file system as /etc (eDir users with home directory on a NSS volume) then the hardlink (or soft link ln -s) will not work. /etc/localtime file will have to be copied in users home directories.
This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.