Archived Forum Post

Index of archived forum posts

Question:

InitializeSftp: Connection closed by server?

May 06 '13 at 16:22

Our Programmer encountered error while implementing the recently purchased product(below), would appreciatte if you can revert back with recommendation or workaround. Please find below LOG of error for your reference.

CODE:

sftp.connect returns 1(successful)
sftp.AuthenticatePW returns 1(successful)
sftp.InitializeSftp() returns 0 then throws this message

LOG:

ChilkatLog:
  InitializeSftp:
    DllDate: Dec 12 2012
    UnlockPrefix: 
    Username: 
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze3
    SftpVersion: 0
    channelType: session
    clientChannel: 0
    clientInitialWindowSize: 327680
    clientMaxPacketSize: 32768
    Sent open channel request
    genRead_14:
      numBytesRequested: 16
      Connection closed by connected peer.
      Failed to read data on SSH connection.
      Failed to read packet from SSH server.
    --genRead_14
    Socket connection lost, channel closed.
    Failed.
  --InitializeSftp
--ChilkatLog


Answer

It could be that the SSH/SFTP user account does not have permission to use SFTP and the server closes the channel when there is an attempt to use the SFTP "subsystem". It's also possible that SFTP is not enabled for that SSH server.


Answer

I have gotten this when the Server side does not have sftp set up correctly, ie incorrect permission on the folder, incorrect permissions on the ssh key. On Unix it has to be a certain setting.