Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

When we use the ftp command or ftp client to connect to a Linux server, the files' modification time shown is different from the time shown in a telnet session.

For example, I have some *.dat files in /home/abc/ and the last modification time shown in the ftp command or client is 19:30. But when I do an ls -l in my telnet session, it shows 03:30. The last modification time shown in the telnet session is correct.

Is there a setting that has gone wrong?

share|improve this question
    
ftp? telnet?? 80's called, they want their protocols back. Are you talking about some embedded system or should you learn about sftp and ssh...? :-) –  Janne Pikkarainen Nov 3 '10 at 3:50
    
unfortunately we are still stuck in the 80's :P –  Alvin Sim Nov 3 '10 at 10:24
    
Are you GMT+8, or is the time offset seemingly meaningless? –  dividius Nov 5 '10 at 11:57
    
yes, my time zone here is GMT +8 –  Alvin Sim Nov 6 '10 at 13:47

3 Answers 3

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.

share|improve this answer
    
we tried connecting via ftp to that server on two different machines, which has the same timezone set as the server, and still the time is show differently that the one in the telnet session. –  Alvin Sim Nov 4 '10 at 8:56

I'd a similar problem with my FTP long ago, But both servers where on the same GMT zone... The problem was that the Software itself has a "GMT" configuration properties. ¿Have u checked all the possible configuration of the service and the server?

check NTP to, maybe he's updating after u manually put the right time.

share|improve this answer
    
then I have to check the time setting on the machine which connects to the server. We actually run a bat file which automatically connects to the server via ftp and mgets some files –  Alvin Sim Nov 6 '10 at 13:48
    
¿What client are u using? Standard windows? Standard Linux? I recomend WinScp, has scripting in "batch" file, in console, can delete afeter transfer... He has the option or preserving TimeStamp... maybe that works for u. winscp.net/eng/docs/faq_timestamp –  Carlos Nov 8 '10 at 8:20
    
in our bat file, it actually calls WinScp to connect to the server to get files and then move them to another directory.. i'll have to lookup the preserving TimeStamp in WinScp.. thanks –  Alvin Sim Nov 8 '10 at 15:34
    
Please ignore my previous comment.. this has nothing to do with WinScp.. just verified with my colleagues.. my bad.. –  Alvin Sim Nov 9 '10 at 5:12
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.