6 Replies Latest reply on Sep 12, 2007 8:16 PM by Ethan_H

    SFTP overwrites file timestamps

    Level 7
      I have defined an SFTP connection to a remote [Red Hat Linux] server in
      Dreamweaver MX 2004 (Mac). Whenever I upload a local file to the remote
      server, it assigns the corresponding file on the remote server the current
      time on that server, rather than assigning it the timestamp of the source
      file itself. Curiously, it also sets the timestamp of my local file to the
      new timestamp of the file on the remote server. So basically, any trace of
      the original file modification time is lost any time I upload to the remote
      server.

      Any ideas on how I can preserve the timestamp of source files when uploading
      via SFTP?

      FYI... To rule out the possibility of any file permissions 'funny-business,'
      I am connecting to the remote host as 'root.'


        • 1. Re: SFTP overwrites file timestamps
          Level 7
          I am also running DW CS3 (Version 9.0 Build 3481) on a Windows PC, and I am
          observing similar behavior to what I described in my original post, which
          involved a Mac running DW MX 2004.

          As with the copy of DW 2004 running on my Mac, I am connecting to the same
          remote server via SFTP from DW CS3 on my PC. If I attempt to upload a file
          from my local site that has the exact same timestamp (i.e., 'file last
          modified' attribute) as the corresponding file on the remote server, the
          timestamp of the file on the remote server gets set to the current time.

          This had not been the case in the past when I was accessing my remote server
          via a locally mounted SMB volume. Back then, if I tried to upload a file
          which had the same timestamp as the corresponding file on the remote server,
          the 'last modified' attribute of the remote file was left untouched.
          Unfortunately, this type of access is no longer available to me, as SMB
          services have been terminated on the remote server.

          Could anyone offer suggestions for preserving the remote timestamp when
          using SFTP in DW? Thank you!


          • 2. Re: SFTP overwrites file timestamps
            Ethan_H Level 1
            The timestamp problem is on the server side rather than with Dreamweaver. Does your server use ProFTPD as the FTP software? If so, there is no way I know of to configure it to preserve timestamps on SFTP transfer. Neither Google nor the ProFTPD docs and forums show anything other than complaints about this behavior.

            In general, Dreamweaver (from DW 2004 and above) manages to figure out synchronization status despite the timestamp problems. The only problem occurs with the switch to or from daylight savings time - at least if your server and work computers reside in different timezones. DW thinks that your *entire* site needs to be updated, either by re-uploading all the files to the server or downloading the full site to your work computer. I do not know if CS3 fixes matters, as I have not owned CS3 until after last Spring's time change.
            • 3. Re: SFTP overwrites file timestamps
              Level 7
              Thank you very for responding! This is precisely the sort of insight I was
              looking for :)

              I'm not sure if our server is running ProFTPD, but I will look into it.
              Should I determine that it is indeed running this software, I would be
              inclined to try something else if it might eliminate the undesirable
              behavior w/ re. to the timestamps. Could you (or anyone else) recommend any
              alternative FTP server packages that do not exhibit this behavior as far as
              you know?

              Thanks again.

              > The timestamp problem is on the server side rather than with Dreamweaver.
              > Does
              > your server use ProFTPD as the FTP software? If so, there is no way I know
              > of
              > to configure it to preserve timestamps on SFTP transfer. Neither Google
              > nor the
              > ProFTPD docs and forums show anything other than complaints about this
              > behavior.


              • 4. Re: SFTP overwrites file timestamps
                Ethan_H Level 1
                Michael,

                Sorry, but I do not know of any reliable (see Note [1] below) Linux FTP server packages that support setting timestamps on uploaded files. There is an FTP command, MDTM, that is used to both query and set file modification times. The MDTM command is not one required by the official FTP spec, so many servers do not implement it. Or, to quote the ProFTPD docs, "In short, it is a royal mess. ProFTPD supports MDTM for retrieving the modification time, in GMT. Period."

                Notes:
                1. There is a commercial FTP server package, ncFTPd, that promises support for using MDTM commands to set file modification times. Whether it works or not, I can't say. This is a closed source product with a history of various exploits. Unless you have a test server handy, and are far more of a Linux geek than I have any desire to become, I wouldn't go that route.
                2. This isn't directly on-topic, but may be of use for folks searching this forum in the future. The link above to the ProFTPd documentation suggests a method to resolve the synchronization problems Dreamweaver has when Daylight Savings Time begins or ends. Add the following lines to the <Global> section of /etc/proftpd.ini:

                  SetEnv TZ :/etc/localtime
                  TimesGMT off

                  I tested this by switching a test computer from Pacific time (currently daylight savings) to Arizona time (Arizona fears DST). Previously, this confused DW, and it wanted to re-synchronize the entire site. After making the above modification to the server configuration file, DW happily reported no files needed synchronization. The true test will come this fall, but preliminary results are promising.

                • 5. Re: SFTP overwrites file timestamps
                  Level 7
                  Thank you again, Ethan. I really appreciate your feedback. However, if
                  you'll permit me to drag this discourse out a little longer, I just wanted
                  to revisit your original response:

                  > The timestamp problem is on the server side rather than with Dreamweaver.
                  > Does
                  > your server use ProFTPD as the FTP software? If so, there is no way I know
                  > of
                  > to configure it to preserve timestamps on SFTP transfer. Neither Google
                  > nor the
                  > ProFTPD docs and forums show anything other than complaints about this
                  > behavior.

                  Does the SFTP protocol have anything at all to do with what FTP software is
                  installed on my remote server. Everything that I've read seems to say 'no.'
                  SFTP is in fact its own protocol entirely (a subset of OpenSSH). The FTP
                  software that is installed (or not installed) on my remote server is not
                  utilized by SFTP. Isn't that right?

                  Furthermore, I have personally observed that SFTP is capable of not stepping
                  on the timestamps of remote files because I also run a program called WinSCP
                  (a GUI-based tool for transferring files over SFTP/SCP), and it contains a
                  setting (which is enabled by default) to preserve the timestamp. And guess
                  what? It works as advertised. I don't have the problems I described w/ re.
                  to SFTP in DW.

                  So I'm just a little stumped as to why DW behaves the way it does. Any
                  other thoughts?


                  • 6. Re: SFTP overwrites file timestamps
                    Ethan_H Level 1
                    You got me there. It appears as though the modifications I posted above to the proftpd.ini file do indeed allow ProFTPd to utilize the MDTM command, documentation notwithstanding.

                    I tried both WinSCP and WS_FTP for file transfer. When the "preserve file times on upload (requires server MDTM support)" box was checked, the file timestamps were indeed preserved. Now all it takes is convincing Adobe to add this option to Drwamweaver.