ftp command shows different file modification time

Solution 1:

After 2 years, today I found out that the cause of the problem is because the FTP timestamps are set to GMT instead of following the correctly set timezone as highlighted in this URL

But in the URL, the change was done to the /etc/proftpd.conf. This Linux server is using vsftpd. So there is a slight change to the solution.

Edit the vsftpd configuration file and append this to it use_localtime=YES. Then restart vsftpd

Here is a more detailed step I did:

  1. Logged in as a non-root user
  2. su to root
  3. Find which ftpd it is runnning. For this server it is using vsftpd

    $ ps -ef | grep ftpd

  4. Make a copy of the configuration file.

  5. Use an editor to edit the vsftpd configuration file.

    $ vim /etc/vsftpd/vsftpd.conf

  6. Add the option use_localtime and set the value to YES. The default value is NO

    use_localtime=YES

  7. Restart the ftpd service

    $ /sbin/service vsftpd restart

    $ /sbin/service vsftpd status

  8. Retry login using ftp and check the file timestamp.

Solution 2:

I'm not positive about this, but perhaps is the timezone on your client set differently than on the server? That could cause your ftp client to display the time with an incorrect offset.

Tags:

Linux

Ftp