Archived Forum Post

Index of archived forum posts

Question:

TCL SFTP example not working

Jul 22 '17 at 21:55

I was following an TCL SFTP example provided by this ChilKat example. The firewall of my servers are disabled and it seems that script fails at CkSFtp_Connect level and never proceeds to the authentication. I attached the chilkat log output below. The log file doesn't seem to indicate any error. Any help is appreciated! thank you.

connecting ChilkatLog: Connect_SFtp: DllDate: May 26 2017 ChilkatVersion: 9.5.0.68 UnlockPrefix: Anything for 30 day trial Architecture: Little Endian; 64-bit Language: Linux Tcl VerboseLogging: 0 SftpVersion: 0 connectInner: sshConnect: Established TCP/IP connection with SSH server --sshConnect sshSetupConnection: clientIdentifier: SSH-2.0-PuTTY_Release_0.69 Sending client identifier... Done sending client identifier. Reading server version... initialDataFromSshServer: SSH-2.0-OpenSSH_6.6.1

    serverVersion: SSH-2.0-OpenSSH_6.6.1
    KeyExchangeAlgs:
      algorithm: curve25519-sha256@libssh.org
      algorithm: ecdh-sha2-nistp256
      algorithm: ecdh-sha2-nistp384
      algorithm: ecdh-sha2-nistp521
      algorithm: diffie-hellman-group-exchange-sha256
      algorithm: diffie-hellman-group-exchange-sha1
      algorithm: diffie-hellman-group14-sha1
      algorithm: diffie-hellman-group1-sha1
    --KeyExchangeAlgs
    HostKeyAlgs:
      algorithm: ssh-rsa
      algorithm: ecdsa-sha2-nistp256
      algorithm: ssh-ed25519
    --HostKeyAlgs
    EncCS:
      algorithm: aes128-ctr
      algorithm: aes192-ctr
      algorithm: aes256-ctr
      algorithm: arcfour256
      algorithm: arcfour128
      algorithm: aes128-gcm@openssh.com
      algorithm: aes256-gcm@openssh.com
      algorithm: chacha20-poly1305@openssh.com
      algorithm: aes128-cbc
      algorithm: 3des-cbc
      algorithm: blowfish-cbc
      algorithm: cast128-cbc
      algorithm: aes192-cbc
      algorithm: aes256-cbc
      algorithm: arcfour
      algorithm: rijndael-cbc@lysator.liu.se
    --EncCS
    EncSC:
      algorithm: aes128-ctr
      algorithm: aes192-ctr
      algorithm: aes256-ctr
      algorithm: arcfour256
      algorithm: arcfour128
      algorithm: aes128-gcm@openssh.com
      algorithm: aes256-gcm@openssh.com
      algorithm: chacha20-poly1305@openssh.com
      algorithm: aes128-cbc
      algorithm: 3des-cbc
      algorithm: blowfish-cbc
      algorithm: cast128-cbc
      algorithm: aes192-cbc
      algorithm: aes256-cbc
      algorithm: arcfour
      algorithm: rijndael-cbc@lysator.liu.se
    --EncSC
    MacCS:
      algorithm: hmac-md5-etm@openssh.com
      algorithm: hmac-sha1-etm@openssh.com
      algorithm: umac-64-etm@openssh.com
      algorithm: umac-128-etm@openssh.com
      algorithm: hmac-sha2-256-etm@openssh.com
      algorithm: hmac-sha2-512-etm@openssh.com
      algorithm: hmac-ripemd160-etm@openssh.com
      algorithm: hmac-sha1-96-etm@openssh.com
      algorithm: hmac-md5-96-etm@openssh.com
      algorithm: hmac-md5
      algorithm: hmac-sha1
      algorithm: umac-64@openssh.com
      algorithm: umac-128@openssh.com
      algorithm: hmac-sha2-256
      algorithm: hmac-sha2-512
      algorithm: hmac-ripemd160
      algorithm: hmac-ripemd160@openssh.com
      algorithm: hmac-sha1-96
      algorithm: hmac-md5-96
    --MacCS
    MacSC:
      algorithm: hmac-md5-etm@openssh.com
      algorithm: hmac-sha1-etm@openssh.com
      algorithm: umac-64-etm@openssh.com
      algorithm: umac-128-etm@openssh.com
      algorithm: hmac-sha2-256-etm@openssh.com
      algorithm: hmac-sha2-512-etm@openssh.com
      algorithm: hmac-ripemd160-etm@openssh.com
      algorithm: hmac-sha1-96-etm@openssh.com
      algorithm: hmac-md5-96-etm@openssh.com
      algorithm: hmac-md5
      algorithm: hmac-sha1
      algorithm: umac-64@openssh.com
      algorithm: umac-128@openssh.com
      algorithm: hmac-sha2-256
      algorithm: hmac-sha2-512
      algorithm: hmac-ripemd160
      algorithm: hmac-ripemd160@openssh.com
      algorithm: hmac-sha1-96
      algorithm: hmac-md5-96
    --MacSC
    CompCS:
      algorithm: none
      algorithm: zlib@openssh.com
    --CompCS
    CompSC:
      algorithm: none
      algorithm: zlib@openssh.com
    --CompSC
    ChosenIncomingEncryption: chacha20-poly1305@openssh.com
    ChosenOutgoingEncryptoin: chacha20-poly1305@openssh.com
    ChosenIncomingMac: hmac-sha1
    ChosenOutgoingMac: hmac-sha1
    ChosenIncomingCompression: none
    ChosenOutgoingCompression: none
    ChosenKexAlgorithm: curve25519-sha256@libssh.org
    ChosenHostKeyAlgorithm: ssh-rsa
    Using SHA256 for Key Exchange Hash
    verifyHostKey:
      rsaHostKeyVerify:
        alg: ssh-rsa
      --rsaHostKeyVerify
    --verifyHostKey
    Sending newkeys to server...
    Expecting newkeys from server...
    SSH Key Exchange Success.
    installNewKeys:
      m_isRekey: 0
      No outgoing compression.
      No incoming compression.
      Outgoing encryption is now chacha20-poly1305@openssh.com
      Incoming encryption is now chacha20-poly1305@openssh.com
    --installNewKeys
  --sshSetupConnection
  socketOptions:
    SO_SNDBUF: 425984
    SO_RCVBUF: 425984
    TCP_NODELAY: 1
    SO_KEEPALIVE: 0
  --socketOptions
--connectInner
Success.   --Connect_SFtp

--ChilkatLog


Answer

The Connect call worked, so it must be that the TCL example code is incorrect? This is the snippet for the Connect call and checking the return value:

set hostname "www.my-ssh-server.com"
set port 22
set success [CkSFtp_Connect $sftp $hostname $port]
if {[expr $success != 1]} then {
    puts [CkSFtp_lastErrorText $sftp]
    delete_CkSFtp $sftp
    exit
}

What is the value of $success that was returned? Maybe the expression in the "if" statement is not correct?