Archived Forum Post

Index of archived forum posts

Question:

SFTP/SSH Connection Issue

Jun 12 '13 at 11:04

Having trouble getting the sftp/ssh to work following the c# example and using the 9.4 version.

sftp.Connect(host,port) works ok, sshkey.LoadText(keyfile) and sshkey.FromPuttyPrivateKey work ok, but as soon as i try sftp.AuthenticatePk(user, key) I get the timeout shown below.

Is there anything we need to load related to the public key from the SSH server I'm connecting to or is that just assumed to be ok?

At the moment this looks just like another issue reported with 9.3.2-ios-6.0 that was fixed with a different build, but I'm assuming user error somewhere still....

thanks, Steve

Error: Unable to AuthenticatePk, Login Failed, 
ChilkatLog:
  AuthenticatePk:
    DllDate: Dec 12 2012
    UnlockPrefix: <deleted>
    Username: HPDV4:sjs
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 0
    SshVersion: SSH-2.0-Maverick_SSHD
    SftpVersion: 0
    login: <deleted>
    SentServiceReq: ssh-userauth
    genRead_2:
      Timeout waiting to read socket or accept connection
      timeoutMs: 15000
      SSH readRawPacket: Socket read timed out.
    --genRead_2
    Error reading service accept.
    Failed.
  --AuthenticatePk
--ChilkatLog

SessionLog=TRAN* Established TCP/IP connection with SSH server
TRAN> SSH-2.0-PuTTY_Local:_May_11_2009_17:22:38
TRAN< SSH-2.0-Maverick_SSHD
TRAN> KEXINIT
TRAN< KEXINIT
TRAN* Key Algorithms: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
TRAN* Host Key Algorithms: ssh-rsa
TRAN* Out Encryption: aes128-cbc,aes256-cbc,aes192-cbc,3des-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc
TRAN* In Encryption: aes128-cbc,aes256-cbc,aes192-cbc,3des-cbc,twofish256-cbc,twofish192-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc
TRAN* Out MAC: hmac-sha1,hmac-sha1-96
TRAN* In MAC: hmac-sha1,hmac-sha1-96
TRAN* Out Compress: zlib
TRAN* In Compress: zlib
TRAN> KEX_DH_GEX_REQUEST
TRAN< KEX_DH_GEX_GROUP/KEXDH_REPLY
TRAN> KEXDH_INIT
TRAN< KEX_DH_GEX_REPLY
TRAN* RSA signature verified
TRAN> NEWKEYS
TRAN< NEWKEYS
TRAN* SSH Key Exchange Success.
TRAN> IGNORE
TRAN> SERVICE_REQUEST

CodeSnip:

ftpproc.KeepSessionLog = true;
ftpproc.ConnectTimeoutMs = 15000;
ftpproc.IdleTimeoutMs = 15000;

ok = ftpproc.Connect(Host, PortNum);
if (!ok)
   s.Append("Connect Failed: " + Environment.NewLine + ftpproc.SessionLog + Environment.NewLine);

Chilkat.SshKey key = new SshKey();
string priKey = key.LoadText(KeyFile);

if (ok)
{
  ok = (priKey != null);
  if (!ok)
     s.Append("Error: Null Private Key For SFTP, error=" + key.LastErrorText + Environment.NewLine);
}

if (ok)
{
  ok = key.FromPuttyPrivateKey(priKey);
  if (!ok)
     s.Append("Error: FromPuttyPrivateKey, error=" + key.LastErrorText + Environment.NewLine);
}

if (ok)
{
   ok = ftpproc.AuthenticatePk(User, key);
   if (!ok)
      s.Append("Error: Unable to AuthenticatePk, Login Failed, " + Environment.NewLine + 
            "FtpLastError=" + ftpproc.LastErrorText + Environment.NewLine + 
                "SessionLog=" + ftpproc.SessionLog);
}


Accepted Answer

Please check to see if this new build resolves the problem:

http://www.chilkatsoft.com/preRelease/ChilkatDotNet2-9.4.1-win32.zip


Answer

The updated 9.4.1 preRelease build looks good with the testing I've done so far.

Any idea when this version will be officially released?

thanks, Steve


Answer

Make sure to follow the tech notes blog: http://www.cknotes.com/?cat=100