Windows: connect to SFTP

This is the error that I’m getting:

Testing Connection ...
+ set color:use-color yes
+ set cmd:interactive yes
+ set file:charset utf-8
+ set xfer:clobber on
+ set ftp:timezone
+ set cmd:show-status yes
+ set cmd:set-term-status yes
+ set ftp:list-options -a
+ set cmd:fail-exit yes
+ set cmd:time-style "%Y-%m-%d %H:%M:%S"
+ set ftp:ssl-allow no
+ set ssl:verify-certificate no
+ set sftp:auto-confirm yes
+ set sftp:connect-program "ssh -a -x -v"
+ set net:max-retries 3
+ set net:timeout 20
+ set net:reconnect-interval-base 5
+ set net:reconnect-interval-multiplier 1
+ open -u **user**,**pass** sftp://xxx.xxx.xxx.xxx
+ cd /var/www/html/intranet
---- Running connect program (ssh -a -x -v -s -l **user** xxx.xxx.xxx.xxx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- execl(/bin/sh) failed: No such file or directory
**** Peer closed connection
---- Disconnecting
cd `/var/www/html/intranet' [execl(/bin/sh) failed: No such file or d---- Running connect program (ssh -a -x -v -s -l **user** xxx.xxx.xxx.xxx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- execl(/bin/sh) failed: No such file or directory
**** pty read: pseudo-tty: Input/output error
**** execl(/bin/sh) failed: No such file or directory
---- Disconnecting
cd `/var/www/html/intranet' [execl(/bin/sh) failed: No such file or d---- Running connect program (ssh -a -x -v -s -l **user** xxx.xxx.xxx.xxx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- execl(/bin/sh) failed: No such file or directory
**** pty read: pseudo-tty: Input/output error
**** execl(/bin/sh) failed: No such file or directory
---- Disconnecting
cd: Fatal error: max-retries exceeded (execl(/bin/sh) failed: No such file or directory)

I have set the correct remote directory too. When I connect with exactly the same credentials with Filezilla, it works just fine. Any ideas?

Hello Nevil,
@patrick will check this.

There is an installation conflict currently on Windows with SFTP.

We are trying to fix it but it is a bit of a mess on Windows because of the many different programs installed for SSH. Microsoft even added their own in the latest Windows 10 update.

So for now it is better to use regular FTP or FTPS on Windows instead of SFTP

FTP is not an option. Not safe at all.

I just tried the update by the way, now the error with SFTP is different:

Testing Connection …

  • set color:use-color yes
  • set cmd:interactive yes
  • set file:charset utf-8
  • set xfer:clobber on
  • set ftp:timezone
  • set cmd:show-status yes
  • set cmd:set-term-status yes
  • set ftp:list-options -a
  • set cmd:fail-exit yes
  • set cmd:time-style “%Y-%m-%d %H:%M:%S”
  • set ftp:ssl-allow no
  • set ssl:verify-certificate no
  • set sftp:auto-confirm yes
  • set sftp:connect-program “ssh -a -x -v”
  • set net:max-retries 3
  • set net:timeout 20
  • set net:reconnect-interval-base 5
  • set net:reconnect-interval-multiplier 1
  • open -u user,pass sftp://xxx.xxx.xxx.xxx
  • cd /var/www/html/intranet/
    ---- Running connect program (ssh -a -x -v -s -l user xxx.xxx.xxx.xxx sftp)
    —> sending a packet, length=5, type=1(INIT), id=0
    <— OpenSSH_7.6p1, OpenSSL 1.0.2m 2 Nov 2017
    <— debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
    <— debug1: Connection established.
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_rsa type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_rsa-cert type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_dsa type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_dsa-cert type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_ecdsa type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_ecdsa-cert type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_ed25519 type -1
    <— debug1: key_load_public: No such file or directory
    <— debug1: identity file /cygdrive/c/Users/user/.ssh/id_ed25519-cert type -1
    <— debug1: Local version string SSH-2.0-OpenSSH_7.6
    <— debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
    <— debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
    <— debug1: Authenticating to xxx.xxx.xxx.xxx:22 as ‘user
    <— debug1: SSH2_MSG_KEXINIT sent
    <— debug1: SSH2_MSG_KEXINIT received
    <— debug1: kex: algorithm: mysite.com
    <— debug1: kex: host key algorithm: ssh-ed25519
    <— debug1: kex: server->client cipher: mysite.com MAC: compression: none
    <— debug1: kex: client->server cipher: mysite.com MAC: compression: none
    <— debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    <— debug1: Server host key: ssh-ed25519 SHA256:w6VqIlMIvZb9Z4UDxZIZikEqDCkSC++PsvgVeOL4bQo
    <— debug1: Host ‘xxx.xxx.xxx.xxx’ is known and matches the ED25519 host key.
    <— debug1: Found key in /cygdrive/c/Users/user/.ssh/known_hosts:1
    <— debug1: rekey after 134217728 blocks
    <— debug1: SSH2_MSG_NEWKEYS sent
    <— debug1: expecting SSH2_MSG_NEWKEYS
    <— debug1: SSH2_MSG_NEWKEYS received
    <— debug1: rekey after 134217728 blocks
    <— debug1: SSH2_MSG_EXT_INFO received
    <— debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
    <— debug1: SSH2_MSG_SERVICE_ACCEPT received
    <— debug1: Authentications that can continue: publickey,password
    <— debug1: Next authentication method: publickey
    <— debug1: Trying private key: /cygdrive/c/Users/user/.ssh/id_rsa
    <— debug1: Trying private key: /cygdrive/c/Users/user/.ssh/id_dsa
    <— debug1: Trying private key: /cygdrive/c/Users/user/.ssh/id_ecdsa
    <— debug1: Trying private key: /cygdrive/c/Users/user/.ssh/id_ed25519
    <— debug1: Next authentication method: password
    <— user@xxx.xxx.xxx.xxx’s password: XXXX
    <— debug1: Authentication succeeded (password).
    <— Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]:22).
    <— debug1: channel 0: new [client-session]
    <— debug1: Requesting mysite.com
    <— debug1: Entering interactive session.
    <— debug1: pledge: network
    <— debug1: client_input_global_request: rtype mysite.com want_reply 0
    <— debug1: Sending subsystem: sftp
    <— got a packet, length=150, type=2(VERSION), id=0
    ---- protocol version set to 3
    —> sending a packet, length=10, type=16(REALPATH), id=1
    <— got a packet, length=43, type=104(NAME), id=1
    ---- home set to /home/user
    ---- checking directory `/var/www/html/intranet’
    —> sending a packet, length=31, type=17(STAT), id=2
    —> sending a packet, length=33, type=17(STAT), id=3
    <— got a packet, length=37, type=105(ATTRS), id=2
    <— got a packet, length=37, type=105(ATTRS), id=3
    cd ok, cwd=/var/www/html/intranet
  • ls
    ---- path on wire is `/var/www/html/intranet’
    —> sending a packet, length=31, type=11(OPENDIR), id=4
    <— got a packet, length=13, type=102(HANDLE), id=4
    ---- got file handle 00000000 (4)
    —> sending a packet, length=13, type=12(READDIR), id=5
    <— got a packet, length=207, type=104(NAME), id=5
    ---- file name count=2
    —> sending a packet, length=13, type=12(READDIR), id=6
    —> sending a packet, length=13, type=12(READDIR), id=7
    <— got a packet, length=28, type=101(STATUS), id=6
    ---- status code=1(EOF), message=End of file
    ---- eof
    <— got a packet, length=28, type=101(STATUS), id=7
    ---- status code=1(EOF), message=End of file
    drwxr-xr-x 2 www-data www-data 4096 Dec 11 22:17 .
    drwxrwxr-x 9 root www-data 4096 Dec 13 19:54 …
  • put mysite.com
    —> sending a packet, length=13, type=4(CLOSE), id=8
    ---- path on wire is `/var/www/html/intranet/mysite.com
    —> sending a packet, length=64, type=3(OPEN), id=9
    <— got a packet, length=24, type=101(STATUS), id=8
    ---- status code=0(OK), message=Success
    <— got a packet, length=34, type=101(STATUS), id=9
    ---- status code=3(Permission denied), message=Permission denied
    put: Access failed: Permission denied (mysite.com)
    ---- Disconnecting

Maybe it works now but with different settings maybe?

Yes in today’s update 1.7 we fixed the SFTP on Windows so it should fully work without any external programs.

I see in your log that is also working but you just don’t have permission to upload files, so you getting access denied.

So just check your account permissions. The connect works fine at least