What's new

File Timestamps are 2 hours ahead in FTP server

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

umur

New Around Here
Hello everyone,

I have been using Asus DSL-AX82U with custom firmware (3004.388.6_2-gnuton1).

I have connected a USB storage device to use it as FTP server. After setting up DDNS, AiDisk, AiCloud etc), I did a few test and I can copy my files and access remotely. So far so good.

Then, I start testing few programs for sync purposes, i.e., WinSCP, FreeFileSync. Then, I realized that the timestamp of the files in the FTP server are 2 hours ahead of the actual timestamp. This creates a problem with the sync programs since they check the time stamp of the two directories before initiating sync and it leads all directory to be synced (due to this 2 hours of difference in each file between two repos). I have tried to shift the time zone back by two hours to add the negative offset but it did not work. The timestamps are still 2 hours ahead of my local time.

PS: When I look at the system logs, the time stamps of each log is correct, the issue exist only with the files in the FTP server behind the router.
PS2: I rebooted the router after each attempt to fix, the issue still persist.

You can see the time config of my router below.

I am a networking rookie and I would appreciate any help here.

NTP config.JPG
 
Also confirm the link target of localtime:
Code:
ls -l /etc/localtime
 
Also confirm the link target of localtime:
Code:
ls -l /etc/localtime
Hello Dave,

Here is the link target of localtime, see ss below. When I got this, my local time was 20:49 whereas it shows 20:45 (still not 2h ahead).


localtime.JPG
 
Thanks @umur, that all looks correct.

Here is the link target of localtime, see ss below. When I got this, my local time was 20:49 whereas it shows 20:45 (still not 2h ahead).
The link creation time should be the time when your router booted up.

The only thing I can think of is that the vsftp server started up before the timezone was set. But that seems very unlikely. If you turn the ftp server off and then on in the GUI do you then get the correct timestamps for the transferred files?

If you touch a new file from an SSH session does it match your local time?
Code:
# touch /tmp/AAA
# ls -l /tmp/AAA
-rw-rw-rw-    1 admin    root             0 May 15 20:35 /tmp/AAA
# date
Wed May 15 20:35:37 DST 2024
 
Thanks @umur, that all looks correct.


The link creation time should be the time when your router booted up.

The only thing I can think of is that the vsftp server started up before the timezone was set. But that seems very unlikely. If you turn the ftp server off and then on in the GUI do you then get the correct timestamps for the transferred files?

If you touch a new file from an SSH session does it match your local time?
Code:
# touch /tmp/AAA
# ls -l /tmp/AAA
-rw-rw-rw-    1 admin    root             0 May 15 20:35 /tmp/AAA
# date
Wed May 15 20:35:37 DST 2024
Hello Colin,

Thanks alot for checking further.

Before I turn off/on ftp server, I tried something different and found something that may hint to the actual problem.

Instead of touch new file, I checked the ftp server directory files from ssh session. I have two dummy files in this directory for test purposes. When I check the timestamp from the ssh session, the timestamp is correct (see below).

ssh timestamp.JPG


However, when I check the timestamp of the same file from the FreeFileSync, WinSCP or from file browser (via ftp connection), it shows the timestamp 2 hours ahead of the timestamp from the ssh connection (see the other screenshots below). Does that ring any bell?

Freesync screenshot
freesync timestamp.JPG


Browser (ftp connection) timestamp
ftp timestamp.JPG
 
That's interesting.

I had assumed that the 2 hour difference was because it was reporting GMT times and your local time is GMT+2. But that's doesn't seem to be the case. The 2 hours is in the opposite direction, so it looks like it's reporting GMT+4.

I can't think why that would happen. Go ahead and restart vsftpd and see if the timestamp shown by your clients changes.
 
That's interesting.
Hello @ColinTaylor ,

I have run the following codes

Bash:
admin@DSL-AX82U-9528:/tmp/mnt/PIMRC_USB/FreeFileSyncRemote# service restart_vsftpd

Done.
admin@DSL-AX82U-9528:/tmp/mnt/PIMRC_USB/FreeFileSyncRemote# service restart_ftpd

Done.

Then, I have created a new file with touch. Unfortunately, it did not work. The issue persist.
 
Have you tried this from a different PC?
I will try with a different pc tomorrow. For the moment, I tried from my android phone, using ftpbox app. It seems that the timestamp is correct when I chexk from ftpbox app. See below. What can be wrong with my PC then?

Screenshot_2024-05-16-00-49-26-71_133d2a2be9960629616444fc49cdc89e.jpg
 
Sorry, I can't reproduce this problem. But then I'm not using the same router as you.

Given that it worked OK with your android phone I can only assume it's a problem on the client side.

The only client software I have in common with you is WinSCP. If you open its log file (Options > Preferences > Logging) do you see the correct timezone information at the beginning of the session?
Rich (BB code):
. 2024-05-16 13:30:44.856 --------------------------------------------------------------------------
. 2024-05-16 13:30:44.856 WinSCP Version 6.3.3 (Build 14916 2024-04-16) (OS 10.0.22631 – Windows 10 Enterprise)
. 2024-05-16 13:30:44.856 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-05-16 13:30:44.856 Log level: Normal
. 2024-05-16 13:30:44.856 Local account: zen\Colin
. 2024-05-16 13:30:44.856 Working directory: C:\Program Files (x86)\WinSCP
. 2024-05-16 13:30:44.856 Process ID: 5212
. 2024-05-16 13:30:44.856 Ancestor processes: ...
. 2024-05-16 13:30:44.856 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"
. 2024-05-16 13:30:44.856 Time zone: Current: GMT+1, Standard: GMT+0 (GMT Standard Time), DST: GMT+1 (GMT Summer Time), DST Start: 31/03/2024, DST End: 27/10/2024
. 2024-05-16 13:30:44.856 Login time: 16 May 2024 13:30:44
. 2024-05-16 13:30:44.856 --------------------------------------------------------------------------
 
Last edited:
Some FTP clients can "adjust" the timestamps with an offset. Filezilla for instance lets you do that in the Site Manager. Make sure your client isn't applying such an offset.
 
Sorry, I can't reproduce this problem. But then I'm not using the same router as you.

Given that it worked OK with your android phone I can only assume it's a problem on the client side.

The only client software I have in common with you is WinSCP. If you open its log file (Options > Preferences > Logging) do you see the correct timezone information at the beginning of the session?
Rich (BB code):
. 2024-05-16 13:30:44.856 --------------------------------------------------------------------------
. 2024-05-16 13:30:44.856 WinSCP Version 6.3.3 (Build 14916 2024-04-16) (OS 10.0.22631 – Windows 10 Enterprise)
. 2024-05-16 13:30:44.856 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-05-16 13:30:44.856 Log level: Normal
. 2024-05-16 13:30:44.856 Local account: zen\Colin
. 2024-05-16 13:30:44.856 Working directory: C:\Program Files (x86)\WinSCP
. 2024-05-16 13:30:44.856 Process ID: 5212
. 2024-05-16 13:30:44.856 Ancestor processes: ...
. 2024-05-16 13:30:44.856 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"
. 2024-05-16 13:30:44.856 Time zone: Current: GMT+1, Standard: GMT+0 (GMT Standard Time), DST: GMT+1 (GMT Summer Time), DST Start: 31/03/2024, DST End: 27/10/2024
. 2024-05-16 13:30:44.856 Login time: 16 May 2024 13:30:44
. 2024-05-16 13:30:44.856 --------------------------------------------------------------------------
Hello Colin,

I appreciate for staying here to identify the problem. Please find the WinSCP logs below. I made the relevant logs in bold and the one most relevant (I guess in red).
My observation is that the timestamps in each log is correct, i.e., represents the time in my PC where I initiated the WinSCP FTP session. Besides, the time zone detection is correct (including the daylight time detection from standard GMT+1 to GMT +2). MDTM feature seems also OK. However, there is one log (in red) where it says Failed to retrieve file /PIMRC_USB/delete/test/WinSCP-6.3.3-Setup.lnk attributes to detect timezone difference. Do you think this would be the problem? If yes, what could be the reason?

PS: I have sensored the log in relevant information with XX YY etc.


Rich (BB code):
. 2024-05-16 16:08:26.631 --------------------------------------------------------------------------
. 2024-05-16 16:08:26.631 WinSCP Version 6.3.3 (Build 14916 2024-04-16) (OS 10.0.19044 – Windows 10 Enterprise)
. 2024-05-16 16:08:26.631 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-05-16 16:08:26.631 Log level: Normal
. 2024-05-16 16:08:26.631 Local account: XXX
. 2024-05-16 16:08:26.631 Working directory: C:\Program Files (x86)\WinSCP
. 2024-05-16 16:08:26.631 Process ID: 28624
. 2024-05-16 16:08:26.645 Ancestor processes: explorer, ...
. 2024-05-16 16:08:26.645 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"
. 2024-05-16 16:08:26.645 Time zone: Current: GMT+2, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 31/03/2024, DST End: 27/10/2024
. 2024-05-16 16:08:26.645 Login time: 16 May 2024 16:08:26
. 2024-05-16 16:08:26.645 --------------------------------------------------------------------------
. 2024-05-16 16:08:26.645 Session name: XXX@XXX.asuscomm.com (Site)
. 2024-05-16 16:08:26.645 Host name: XXX.asuscomm.com (Port: 21)
. 2024-05-16 16:08:26.645 User name: admin (Password: Yes, Key file: No, Passphrase: No)
. 2024-05-16 16:08:26.645 Transfer Protocol: FTP
. 2024-05-16 16:08:26.645 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2024-05-16 16:08:26.645 Disable Nagle: No
. 2024-05-16 16:08:26.645 Proxy: None
. 2024-05-16 16:08:26.645 Send buffer: 262144
. 2024-05-16 16:08:26.645 UTF: Auto
. 2024-05-16 16:08:26.645 FTPS: None [Client certificate: No]
. 2024-05-16 16:08:26.645 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2024-05-16 16:08:26.645 Local directory: C:\Users\XXX\Desktop\delete\test, Remote directory: /PIMRC_USB/delete/test, Update: Yes, Cache: Yes
. 2024-05-16 16:08:26.645 Cache directory changes: Yes, Permanent: Yes
. 2024-05-16 16:08:26.645 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2024-05-16 16:08:26.645 Timezone offset: 0h 0m
. 2024-05-16 16:08:26.646 --------------------------------------------------------------------------
. 2024-05-16 16:08:26.720 Connecting to XXX.asuscomm.com ...
. 2024-05-16 16:08:26.720 Connected with XXX.asuscomm.com. Waiting for welcome message...
< 2024-05-16 16:08:26.720 220 Welcome to ASUS DSL-AX82U FTP service.
> 2024-05-16 16:08:26.720 USER admin
< 2024-05-16 16:08:26.720 331 Please specify the password.
> 2024-05-16 16:08:26.720 PASS ***********
< 2024-05-16 16:08:26.720 230 Login successful.
> 2024-05-16 16:08:26.720 SYST
< 2024-05-16 16:08:26.720 215 UNIX Type: L8
> 2024-05-16 16:08:26.720 FEAT
< 2024-05-16 16:08:26.720 211-Features:
< 2024-05-16 16:08:26.720  EPRT
< 2024-05-16 16:08:26.720  EPSV
< 2024-05-16 16:08:26.720  MDTM
< 2024-05-16 16:08:26.720  PASV
< 2024-05-16 16:08:26.720  ICNV
< 2024-05-16 16:08:26.720  REST STREAM
< 2024-05-16 16:08:26.720  SIZE
< 2024-05-16 16:08:26.720  TVFS
< 2024-05-16 16:08:26.720  UTF8
< 2024-05-16 16:08:26.720 211 End
> 2024-05-16 16:08:26.720 OPTS UTF8 ON
< 2024-05-16 16:08:26.720 200 Always in UTF8 mode.
. 2024-05-16 16:08:26.762 Connected
. 2024-05-16 16:08:26.763 --------------------------------------------------------------------------
. 2024-05-16 16:08:26.763 Using FTP protocol.
. 2024-05-16 16:08:26.763 Doing startup conversation with host.
> 2024-05-16 16:08:26.779 PWD
< 2024-05-16 16:08:26.783 257 "/" is the current directory
. 2024-05-16 16:08:26.783 Changing directory to "/PIMRC_USB/delete/test".
> 2024-05-16 16:08:26.783 CWD /PIMRC_USB/delete/test
< 2024-05-16 16:08:26.785 250 Directory successfully changed.
. 2024-05-16 16:08:26.785 Getting current directory name.
> 2024-05-16 16:08:26.785 PWD
< 2024-05-16 16:08:26.786 257 "/PIMRC_USB/delete/test" is the current directory
. 2024-05-16 16:08:26.843 Retrieving directory listing...
> 2024-05-16 16:08:26.843 TYPE A
< 2024-05-16 16:08:26.845 200 Switching to ASCII mode.
> 2024-05-16 16:08:26.846 PASV
< 2024-05-16 16:08:26.848 227 Entering Passive Mode (XX,YY,ZZ,TT,224,194).
> 2024-05-16 16:08:26.848 LIST -a
. 2024-05-16 16:08:26.848 Connecting to XX.YY.ZZ.TT:57538 ...
< 2024-05-16 16:08:26.851 150 Here comes the directory listing.
. 2024-05-16 16:08:26.852 drwxrwxrwx    1 0        0               0 May 15 03:10 .
. 2024-05-16 16:08:26.852 drwxrwxrwx    1 0        0            8192 May 15 11:27 ..
. 2024-05-16 16:08:26.852 -rwxrwxrwx    1 0        0             799 May 15 01:09 WinSCP-6.3.3-Setup.lnk
. 2024-05-16 16:08:26.859 Data connection closed
< 2024-05-16 16:08:26.859 226 Directory send OK.
. 2024-05-16 16:08:26.859 Directory listing successful
. 2024-05-16 16:08:26.859 Detecting timezone difference...
. 2024-05-16 16:08:26.859 Retrieving file information...
> 2024-05-16 16:08:26.859 PWD
< 2024-05-16 16:08:26.861 257 "/PIMRC_USB/delete/test" is the current directory
> 2024-05-16 16:08:26.861 CWD /PIMRC_USB/delete/test/WinSCP-6.3.3-Setup.lnk
< 2024-05-16 16:08:26.864 550 Failed to change directory.
> 2024-05-16 16:08:26.864 TYPE I
< 2024-05-16 16:08:26.866 200 Switching to Binary mode.
> 2024-05-16 16:08:26.866 SIZE /PIMRC_USB/delete/test/WinSCP-6.3.3-Setup.lnk
< 2024-05-16 16:08:26.868 550 Could not get file size.
. 2024-05-16 16:08:26.868 Could not retrieve file information
. 2024-05-16 16:08:26.868 Failed to retrieve file /PIMRC_USB/delete/test/WinSCP-6.3.3-Setup.lnk attributes to detect timezone difference
. 2024-05-16 16:08:26.868 ..;D;0;1899-12-30T01:00:00.000Z;0;"" [0];"" [0];---------;0
. 2024-05-16 16:08:26.868 WinSCP-6.3.3-Setup.lnk;-;799;2024-05-14T23:09:00.000Z;1;"0" [0];"0" [0];rwxrwxrwx;1
. 2024-05-16 16:08:26.890 Startup conversation with host finished.
. 2024-05-16 16:08:56.845 Sending dummy command to keep session alive.
> 2024-05-16 16:08:56.845 TYPE A
< 2024-05-16 16:08:56.845 200 Switching to ASCII mode.
. 2024-05-16 16:09:26.985 Sending dummy command to keep session alive.
> 2024-05-16 16:09:26.985 TYPE I
< 2024-05-16 16:09:26.985 200 Switching to Binary mode.
 
I have some updates. After vsftpd restart, reboot and FTP server turn on/off, I decided to try this all again.
I deleted the files from server and uploaded them again with winscp. Then, the file timestamps were correct. I tried sync afterwards (with checking timestamp differences) and it did not detect any difference. This probably got somehow fixed after restarting vsftpd, reboot or ftp server off/on.

Then, I checked from FreeFileSync. It still declared new changes when I initiated the sync check. When I executed the sync, I received the following warning message

Rich (BB code):
16:40:37    Warning    Cannot write modification time of "ftp://XXX.asuscomm.com/PIMRC_USB/FreeFileSyncRemote/Capture-4229.ffs_tmp".
            Server does not support the MFMT command.

It seems that it is caused because the MFMT is not supported in the server, right? If that's the problem, what alternative can I use?

Basically, I try to set up an auto-sync between a directory in my pc and ftp server (one-way sync where I will only upload to server, not vice-versa). I checked FTPbox but did not like much as it does not offer many control over the process. Then I tried FreeFileSync and encountered this issue. Would FileZilla be an alternative here? I did not use before but what I need is that the automation should run in the background regularly, and execute the sync based on pre-determined rules without any user interaction required.
 
I've just tried transferring an old file using WinSCP and it preserved the original timestamp by using MDTM. Although apparently that's not an officially supported use of that command. As far as I can tell MFMT was a proposed extension that was never excepted and expired in 2008.

Code:
> 2024-05-16 15:59:08.125 STOR TEST.TXT
. 2024-05-16 15:59:08.125 Connecting to 192.168.1.1:43413 ...
< 2024-05-16 15:59:08.125 150 Ok to send data.
< 2024-05-16 15:59:08.125 226 Transfer complete.
> 2024-05-16 15:59:08.125 MDTM 20200215155944 TEST.TXT
< 2024-05-16 15:59:08.125 213 File modification time set.
. 2024-05-16 15:59:08.125 Upload successful
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top