SFTP question

May 20, 2008
12,340
134
Syracuse, NY, USA
I do this, apparently successfully.
Code:
v:\> iftp /v sftp://vefatica:********@vefatica.net

v:\> iftp
vefatica.net/H:/anonymous/
The server's log shows
Code:
[02] Tue 24Oct17 19:31:56 - (000008) Connected to 72.230.84.150 (local address 72.230.84.150, port 22)
[03] Tue 24Oct17 19:31:56 - (000008) IP-Name: zz.twcny.rr.com (72.230.84.150)
[02] Tue 24Oct17 19:31:56 - (000008) User "vefatica" logged in

But I can't do anything
Code:
v:\> dir sftp:

TCC: (Sys) The system cannot find the file specified.
 "sftp:/H:/anonymous/"
                   0 bytes in 0 files and 0 dirs

The directory exists and is not empty. Am I missing something?
 
It is in sharp contrast to FTP.
Code:
v:\> iftp ftp://vefatica:********@vefatica.net

v:\> iftp
vefatica.net/H:/anonymous

v:\> dir ftp:

 Directory of  ftp://vefatica.net/H:/anonymous/*

2017-08-14  23:35         <DIR>    .
2017-08-14  23:35         <DIR>    ..
2017-10-18  00:44         <DIR>    4plugins
2017-07-21  03:20         <DIR>    pmaddons
2014-08-08  00:00       3,657,325  arnex4.JPG
2012-07-17  00:00         109,138  MercOnSvcDesk.png
           3,766,463 bytes in 2 files and 4 dirs
 
Here's a detailed server log of the failed "dir sftp:".
Code:
[30] Tue 24Oct17 19:54:15 - (000015) SSH2_MSG_USERAUTH_REQUEST: user: vefatica; service: ssh-connection; type: none
[31] Tue 24Oct17 19:54:15 - (000015) SSH2_MSG_USERAUTH_FAILURE: login failed
[30] Tue 24Oct17 19:54:15 - (000015) SSH2_MSG_USERAUTH_REQUEST: user: vefatica; service: ssh-connection; type: password
[02] Tue 24Oct17 19:54:15 - (000015) User "vefatica" logged in
[31] Tue 24Oct17 19:54:15 - (000015) SSH2_MSG_USERAUTH_SUCCESS: successful login
[30] Tue 24Oct17 19:54:15 - (000015) SSH_FXP_INIT: client version 3 (IP*Works! SSH Client 2016)
[31] Tue 24Oct17 19:54:15 - (000015) SSH_FXP_VERSION: server version 3
[30] Tue 24Oct17 19:54:15 - (000015) {0x00000001} SSH_FXP_REALPATH: path: "/H:/anonymous"
[31] Tue 24Oct17 19:54:15 - (000015) {0x00000001} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 19:54:15 - (000015) {0x00000002} SSH_FXP_REALPATH: path: "/H:/anonymous/"
[31] Tue 24Oct17 19:54:15 - (000015) {0x00000002} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 19:54:29 - (000015) {0x00000003} SSH_FXP_REALPATH: path: "/H:/anonymous"
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000003} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 19:54:29 - (000015) {0x00000004} SSH_FXP_OPENDIR: path: "/H:/anonymous"
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000004} SSH_FXP_HANDLE: directory handle: 0x00000000
[32] Tue 24Oct17 19:54:29 - (000015) {0x00000005} SSH_FXP_READDIR: handle: 0x00000000
[33] Tue 24Oct17 19:54:29 - (000015) {0x00000005} SSH_FXP_NAME: found 4 items
[32] Tue 24Oct17 19:54:29 - (000015) {0x00000006} SSH_FXP_READDIR: handle: 0x00000000
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000006} SSH_FX_EOF: End of file.
[30] Tue 24Oct17 19:54:29 - (000015) {0x00000007} SSH_FXP_CLOSE: handle: 0x00000000
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000007} SSH_FX_OK: Success.
[30] Tue 24Oct17 19:54:29 - (000015) {0x00000008} SSH_FXP_REALPATH: path: "/H:/anonymous/"
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000008} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 19:54:29 - (000015) {0x00000009} SSH_FXP_REALPATH: path: "/H:/anonymous"
[31] Tue 24Oct17 19:54:29 - (000015) {0x00000009} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 19:54:29 - (000015) {0x0000000a} SSH_FXP_OPENDIR: path: "/H:/anonymous"
[31] Tue 24Oct17 19:54:29 - (000015) {0x0000000a} SSH_FXP_HANDLE: directory handle: 0x00000001
[32] Tue 24Oct17 19:54:29 - (000015) {0x0000000b} SSH_FXP_READDIR: handle: 0x00000001
[33] Tue 24Oct17 19:54:29 - (000015) {0x0000000b} SSH_FXP_NAME: found 4 items
[32] Tue 24Oct17 19:54:29 - (000015) {0x0000000c} SSH_FXP_READDIR: handle: 0x00000001
[31] Tue 24Oct17 19:54:29 - (000015) {0x0000000c} SSH_FX_EOF: End of file.
[30] Tue 24Oct17 19:54:29 - (000015) {0x0000000d} SSH_FXP_CLOSE: handle: 0x00000001
[31] Tue 24Oct17 19:54:29 - (000015) {0x0000000d} SSH_FX_OK: Success.
[30] Tue 24Oct17 19:54:29 - (000015) {0x0000000e} SSH_FXP_REALPATH: path: "/H:/anonymous/"
 
It works with Putty's PSFTP.EXE. Here's the session, below that the server's log of the session.
Code:
v:\> g:\Putty\PSFTP.EXE vefatica.net
login as: vefatica
vefatica@vefatica.net's password:
Remote working directory is /H:/anonymous
psftp> dir
Listing directory /H:/anonymous
drwxrwxrwx   1 user     group           0 Oct 18 04:44 4plugins
-rw-rw-rw-   1 user     group      109138 Jul 17  2012 MercOnSvcDesk.png
-rw-rw-rw-   1 user     group     3657325 Aug  8  2014 arnex4.JPG
drwxrwxrwx   1 user     group           0 Jul 21 07:20 pmaddons
psftp> bye

v:\> g:\Putty\PSFTP.EXE vefatica.net
login as: vefatica
vefatica@vefatica.net's password:
Remote working directory is /H:/anonymous
psftp> dir
Listing directory /H:/anonymous
drwxrwxrwx   1 user     group           0 Oct 18 04:44 4plugins
-rw-rw-rw-   1 user     group      109138 Jul 17  2012 MercOnSvcDesk.png
-rw-rw-rw-   1 user     group     3657325 Aug  8  2014 arnex4.JPG
drwxrwxrwx   1 user     group           0 Jul 21 07:20 pmaddons
psftp> bye
Code:
[02] Tue 24Oct17 20:07:34 - (000019) Connected to 72.230.84.150 (local address 72.230.84.150, port 22)
[03] Tue 24Oct17 20:07:34 - (000019) IP-Name: zz.twcny.rr.com (72.230.84.150)
[30] Tue 24Oct17 20:07:39 - (000019) SSH2_MSG_USERAUTH_REQUEST: user: vefatica; service: ssh-connection; type: none
[31] Tue 24Oct17 20:07:39 - (000019) SSH2_MSG_USERAUTH_FAILURE: login failed
[32] Tue 24Oct17 20:07:42 - (000019) SSH_MSG_IGNORE: bytes received: 192; uncompressed bytes: 348
[30] Tue 24Oct17 20:07:42 - (000019) SSH2_MSG_USERAUTH_REQUEST: user: vefatica; service: ssh-connection; type: password
[02] Tue 24Oct17 20:07:42 - (000019) User "vefatica" logged in
[31] Tue 24Oct17 20:07:42 - (000019) SSH2_MSG_USERAUTH_SUCCESS: successful login
[30] Tue 24Oct17 20:07:42 - (000019) SSH_FXP_INIT: client version 3 (PuTTY_Release_0.67)
[31] Tue 24Oct17 20:07:42 - (000019) SSH_FXP_VERSION: server version 3
[30] Tue 24Oct17 20:07:42 - (000019) {0x00000100} SSH_FXP_REALPATH: path: "."
[31] Tue 24Oct17 20:07:42 - (000019) {0x00000100} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_REALPATH: path: "/H:/anonymous/."
[31] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_NAME: path: "/H:/anonymous"
[30] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_OPENDIR: path: "/H:/anonymous"
[31] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_HANDLE: directory handle: 0x00000000
[32] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_READDIR: handle: 0x00000000
[33] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_NAME: found 4 items
[32] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_READDIR: handle: 0x00000000
[31] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FX_EOF: End of file.
[30] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FXP_CLOSE: handle: 0x00000000
[31] Tue 24Oct17 20:07:59 - (000019) {0x00000100} SSH_FX_OK: Success.
[02] Tue 24Oct17 20:08:46 - (000019) Closed session
[02] Tue 24Oct17 20:08:46 - (000019) User "vefatica" logged out
 
As I said before, it's OK with FTP but not with SFTP.
Code:
v:\> iftp ftp://vefatica:********@vefatica.net

v:\> iftp
vefatica.net/H:/anonymous

v:\> dir ftp:

 Directory of  ftp://vefatica.net/H:/anonymous/*

2017-08-14  23:35         <DIR>    .
2017-08-14  23:35         <DIR>    ..
2017-10-18  00:44         <DIR>    4plugins
2017-07-21  03:20         <DIR>    pmaddons
2014-08-08  00:00       3,657,325  arnex4.JPG
2012-07-17  00:00         109,138  MercOnSvcDesk.png
           3,766,463 bytes in 2 files and 4 dirs
 
I dunno! It's Serv-U, a pretty mature product. What is the standard format?

The DIR part is better, but this COPY fails sometimes.
Code:
v:\> iftp sftp://rexconn:*************@vefatica.net

v:\> dir ftp:

 Directory of  ftp://vefatica.net/*

2017-10-18  04:44         <DIR>    4plugins
2017-07-21  07:20         <DIR>    pmaddons
2014-08-08  00:00       3,657,325  arnex4.JPG
2012-07-17  00:00         109,138  MercOnSvcDesk.png
           3,766,463 bytes in 2 files and 2 dirs

v:\> copy "ftp:arnex4.JPG"
ftp://vefatica.net/arnex4.JPG/arnex4.JPG => V:\arnex4.JPG
TCC: Get file properties failed [2]: No such file. "/arnex4.JPG/arnex4.JPG"
     0 files copied       1 failed

That works with ordinary FTP.

And this (the first below, no credentials) always fails the first time. After there has been a successful SFTP connection, it succeeds without credentials.
I figured TCC would give the anonymous credentials when I don't specify any.
Code:
v:\> iftp sftp://vefatica.net
TCC: Cannot authenticate with provided credentials. The following authentication methods are available for this user: password,publickey. "vefatica.net"

v:\> iftp sftp://anonymous:jpuser@vefatica.net

v:\> iftp /c

v:\> iftp sftp://vefatica.net

v:\> iftp
vefatica.net/

v:\>[/code]
 
The DIR part is better, but this COPY fails sometimes.
Code:
v:\> iftp sftp://rexconn:*************@vefatica.net

v:\> copy "ftp:arnex4.JPG"
ftp://vefatica.net/arnex4.JPG/arnex4.JPG => V:\arnex4.JPG
TCC: Get file properties failed [2]: No such file. "/arnex4.JPG/arnex4.JPG"
     0 files copied       1 failed

That works with ordinary FTP.

Something is wrong with your SSH server. TCC is attempting to determine whether the argument you passed is a file or a directory. TCC tries to change directories to the argument. If it fails it's a filename; if it succeeds it's a directory. Your server says the directory change to "/arnex4.JPG" succeeded, so everything after that point is bollixed up.
 
Also, your syntax is wrong. You should be using "sftp:" for all of the commands following the IFTP. TCC can usually guess that you entered the wrong FTP designation and autocorrect, but that's not guaranteed (definitely not guaranteed if you have a concurrent IFTP ftp:...).
 
Something is flaky. Here are the very same (exactly) commands I posted last night, when DIR succeeded and COPY failed.
Code:
v:\> iftp sftp://rexconn:***********@vefatica.net

v:\> dir ftp:

TCC: (Sys) The system cannot find the file specified.
 "ftp:/"
                   0 bytes in 0 files and 0 dirs

v:\> copy "ftp:arnex4.JPG"
ftp://vefatica.net/arnex4.JPG => V:\arnex4.JPG
     1 file copied
Today, DIR doesn't work and COPY does. And it's the same if I use the correct "sftp:".
Code:
v:\> iftp sftp://rexconn:************@vefatica.net

v:\> dir sftp:

TCC: (Sys) The system cannot find the file specified.
 "sftp:/"
                   0 bytes in 0 files and 0 dirs

v:\> copy "sftp:arnex4.JPG"
sftp://vefatica.net/arnex4.JPG => V:\arnex4.JPG
     1 file copied

The DIR succeeds if I use sftp:\* or ftp:\* instead of "sftp:" or "ftp:"
 
If you have a wildcard in the name, then TCC knows it cannot be a directory name. If not, TCC tries to determine if it's a file name or a directory name. Apparently your server can't decide.

I tried this on several other SFTP servers and can't reproduce it.
 
Here's ALL that happens when I issue "dir sftp:\*" (which is successful and shows 4 items).
Code:
[30] Sat 11Nov17 11:25:01 - (000094) {0x00000002} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:25:01 - (000094) {0x00000002} SSH_FXP_NAME: path: "/"
[30] Sat 11Nov17 11:25:01 - (000094) {0x00000003} SSH_FXP_OPENDIR: path: "/"
[31] Sat 11Nov17 11:25:01 - (000094) {0x00000003} SSH_FXP_HANDLE: directory handle: 0x00000000
[32] Sat 11Nov17 11:25:01 - (000094) {0x00000004} SSH_FXP_READDIR: handle: 0x00000000
[33] Sat 11Nov17 11:25:01 - (000094) {0x00000004} SSH_FXP_NAME: found 4 items
[32] Sat 11Nov17 11:25:01 - (000094) {0x00000005} SSH_FXP_READDIR: handle: 0x00000000
[31] Sat 11Nov17 11:25:01 - (000094) {0x00000005} SSH_FX_EOF: End of file.
[30] Sat 11Nov17 11:25:01 - (000094) {0x00000006} SSH_FXP_CLOSE: handle: 0x00000000
[31] Sat 11Nov17 11:25:01 - (000094) {0x00000006} SSH_FX_OK: Success.
[30] Sat 11Nov17 11:25:01 - (000094) {0x00000007} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:25:01 - (000094) {0x00000007} SSH_FXP_NAME: path: "/"

And here's what happens when I issue "dir sftp:" The first 12 entries are identical to what's above, but I get the file_not_found message from TCC. Then TCC does the same thing over again, with the same result.
Code:
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000002} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000002} SSH_FXP_NAME: path: "/"
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000003} SSH_FXP_OPENDIR: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000003} SSH_FXP_HANDLE: directory handle: 0x00000000
[32] Sat 11Nov17 11:26:06 - (000095) {0x00000004} SSH_FXP_READDIR: handle: 0x00000000
[33] Sat 11Nov17 11:26:06 - (000095) {0x00000004} SSH_FXP_NAME: found 4 items
[32] Sat 11Nov17 11:26:06 - (000095) {0x00000005} SSH_FXP_READDIR: handle: 0x00000000
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000005} SSH_FX_EOF: End of file.
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000006} SSH_FXP_CLOSE: handle: 0x00000000
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000006} SSH_FX_OK: Success.
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000007} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000007} SSH_FXP_NAME: path: "/"
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000008} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000008} SSH_FXP_NAME: path: "/"
[30] Sat 11Nov17 11:26:06 - (000095) {0x00000009} SSH_FXP_OPENDIR: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x00000009} SSH_FXP_HANDLE: directory handle: 0x00000001
[32] Sat 11Nov17 11:26:06 - (000095) {0x0000000a} SSH_FXP_READDIR: handle: 0x00000001
[33] Sat 11Nov17 11:26:06 - (000095) {0x0000000a} SSH_FXP_NAME: found 4 items
[32] Sat 11Nov17 11:26:06 - (000095) {0x0000000b} SSH_FXP_READDIR: handle: 0x00000001
[31] Sat 11Nov17 11:26:06 - (000095) {0x0000000b} SSH_FX_EOF: End of file.
[30] Sat 11Nov17 11:26:06 - (000095) {0x0000000c} SSH_FXP_CLOSE: handle: 0x00000001
[31] Sat 11Nov17 11:26:06 - (000095) {0x0000000c} SSH_FX_OK: Success.
[30] Sat 11Nov17 11:26:06 - (000095) {0x0000000d} SSH_FXP_REALPATH: path: "/"
[31] Sat 11Nov17 11:26:06 - (000095) {0x0000000d} SSH_FXP_NAME: path: "/"
 

Similar threads