File uploaded with pure-ftpd has time stamp off by x hours

This document (7002717) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Desktop 11
SUSE Linux Enterprise Desktop 10
SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10

Situation

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.

Resolution

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
   start)
 
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:
 
mkdir /srv/ftp/etc
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. 

Disclaimer

This Support Knowledgebase provides a valuable tool for 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.

  • Document ID:7002717
  • Creation Date: 20-Feb-2009
  • Modified Date:28-Sep-2022
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center