Author Topic: Suddenly unable to SFTP files  (Read 11601 times)

zenzic

  • Community Member
  • Posts: 5
  • Hero Points: 0
Suddenly unable to SFTP files
« on: March 26, 2010, 06:07:12 PM »
I am suddenly unable to edit files on a remote server using SFTP.  When I attempt a connection with the FTP toolbar, I get (seemingly randomly) one of the following error messages:

Cannot authenticate: Received error.
debug1: SSH@_MSG_SERVICE_REQUEST sent

Cannot authenticate: Received error.
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss

Cannot authenticate: Received error.
debug3: key_read: missing whitespace

Cannot initialize SFTP: Error waiting for SSH_FXP_VERSION packet. status=-33
debug3: key_read: missing whitespace

The only change on my system that I am aware of is that I installed a new Cygwin package which may have installed a new version of Cygwin.  They tend to do that without warning when you run the installer.

Can anyone give me a suggestion here.  I do not believe it is my key as I can still ssh without any problems.

Thanks,
Jerry

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Suddenly unable to SFTP files
« Reply #1 on: March 26, 2010, 08:25:25 PM »
What flavor of Windows are you on? We've seen a lot of problems with newer versions of Cygwin installed on Windows Vista and Windows 7, mostly with how the installation creates symbolic links. The links work fine in the cygwin shell, but non-shell processes don't have the "inside info" to make it work somehow.

One suggestion is to copy your .ssh directory from your cygwin's $HOME directory to your Windows user profile directory. (Or the other way around).

I don't yet have a second suggestion...

zenzic

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Suddenly unable to SFTP files
« Reply #2 on: March 26, 2010, 09:34:07 PM »
Matthew,

I am running Windows XP Sp3.

I copied my $HOME/.ssh directory to my windows profile directory as you suggested, and while it didn't fix the error, it did change the error message a bit.  It now consistently says:

Cannot initialize SFTP: Error waiting for SSH_FXP_VERSION packet. status=-33
debug3: key_read: missing whitespace

If I remove the new .ssh dir, the message consistently goes back to:

Cannot authenticate: Received error.
debug3: key_read: missing whitespace

I don't know if that tells you anything or not, but I appreciate your help.

Thanks,
Jerry


Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Suddenly unable to SFTP files
« Reply #3 on: March 26, 2010, 11:28:02 PM »
Problem: After upgrading the cygwin Base package to 1.7.2-2 (released March 24 2010), attempting to connect to a host via SFTP will give you any or all of the following messages:

Code: [Select]
Cannot authenticate: Received error.
debug1: SSH@_MSG_SERVICE_REQUEST sent

Cannot authenticate: Received error.
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss

Cannot authenticate: Received error.
debug3: key_read: missing whitespace

Cannot initialize SFTP: Error waiting for SSH_FXP_VERSION packet. status=-33
debug3: key_read: missing whitespace

The problem is definitely somewhere in this newer version of cygwin1.dll. We have run into problems in the past after Cygwin posted an update (the last one involved pipe handling in 2008 which the Cygwin folks corrected a little later in a patch release).

To work around the problem you will have to revert back to version 1.7.1-1 of the 'cygwin' Base package. You can do this from the Cygwin setup.exe.

We will look into this and fix it if it turns out to be our problem. If the problem lies with this latest cygwin1.dll, then hopefully the Cygwin folks will correct it on their own in short order. In the meantime, you have a short-term solution.

Thanks for letting us know!

--rodney

zenzic

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Suddenly unable to SFTP files
« Reply #4 on: March 26, 2010, 11:49:00 PM »
Rodney,

Thank you very much for the help.

Jerry

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Suddenly unable to SFTP files
« Reply #5 on: March 27, 2010, 05:39:33 AM »
FYI: I just looked over the source code changes for Cygwin 1.7.2. They definitely changed a fundamental behavior of their execvp() and execvpe() functions used to spawn a program. The new behavior basically ignores the fact that an absolute native path is passed in when doing a PATH search for the program and returns null (i.e. not found) when it should just use the path passed in. I can only imagine that others will have serious issues with this change. I do know how to work around it if necessary, but I would like to wait a bit to see if they fix it.

--rodney

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Suddenly unable to SFTP files
« Reply #6 on: March 27, 2010, 04:58:16 PM »
I looked into it further and found a much simpler workaround that is backward compatible with Cygwin 1.7.1. This allows us to use it as a permanent fix regardless of whether the Cygwin folks fix their problem or not.

The attached fix applies to SlickEdit 14.0.2 only. Assuming you are on 14.0.2, please follow the instructions:

1. Backup slickedit/macros/sftpq.e and replace with attached.
2. Run SlickEdit and load sftpq.e from Macro>Load Module.
3. Test it out with Cygwin 1.7.1 (I'm assuming you took my advice and downgraded it).
4. Upgrade Cygwin to latest (1.7.2) and re-test.

If I do not hear of any issues with the fix, then I will roll it into the next hotfix.

--rodney

p.s. I would also love it if somebody on an older Cygwin (~1.5.x) could test this and report back.

zenzic

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Suddenly unable to SFTP files
« Reply #7 on: March 28, 2010, 03:58:44 AM »
Rodney,

I did take your advice and rolled back to Cygwin 1.7.1, fixing my problem.  Unfortunately I can't try your SFTP fix as I'm using SlickEdit 13.0.2.

I will try to report the issue to the Cygwin folks to see if they will take a look at it.

Thanks again,
Jerry

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Suddenly unable to SFTP files
« Reply #8 on: March 28, 2010, 04:51:32 AM »
Well, I'm sure you can still try it since the code is not that much different from 13.0.2. If you are interested you can download the new sftpq.e (not to your macros/ folder) and use the Diff tool (Tools menu) to diff your existing macros/sftpq.e with the new one. The only bit you need looks like this in function _sftpQEHandler_SSHStart():

Code: [Select]
#if !__UNIX__
      // Cygwin 1.7.2-2 (24March2010) breaks path-search when resolving
      // a path using DOS-backslash separators, so we must translate to
      // UNIX separator. Reading through their cygwin mailing list, it
      // sounds like they are aware of the problem and might get around
      // to fixing it eventually. It should be safe for us to make this
      // a permanent fix though because it is backward compatible with
      // 1.7.1.
      askpass_path = translate(askpass_path,'/','\');
#endif

Save and load (Macro>Load Module).

--rodney

zenzic

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Suddenly unable to SFTP files
« Reply #9 on: March 29, 2010, 01:30:16 AM »
Hi Rodney,

Thanks again for your help.  I did merge your change into the existing sftpq.e and am able to confirm that it works with both Cygwin 1.7.1-1 and 1.7.2-2.

Jerry

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 384
  • Hero Points: 29
Re: Suddenly unable to SFTP files
« Reply #10 on: April 01, 2010, 07:13:58 PM »
This fix has been included in the most recent hotfix for SlickEdit 2009, located at www.slickedit.com/hotfix.

Thx,
Ashley

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Suddenly unable to SFTP files
« Reply #11 on: April 14, 2010, 04:39:36 PM »
The Cygwin folks fixed this pretty quick in 1.7.3 (Apr 7 I think).

From the 1.7.3 release notes:
- Enable finding paths in backslash notation in calls to execvp/execlp.

Anybody on a version prior to v14 should be okay to upgrade their Cygwin.

--rodney