Topic "SFTP Path Length Error"

Author Message
Buc

Guest


I was under the impression that SFTP protocol would handle long file/path lengths vs regular FTP protocol. Maybe I am wrong. If not, I am having an issue with WinSCP throwing an error when it encounters a file with a path + filename > 260 chars. I get a permission denied error #3. Here is the command. I have checked security settings, no problems. Tried on Windows 7, 8.1, Windows 10, 2012R2 , WinSCP 5.11.1 with same results


open sftp://ftp:@ftp@172.xx.xx.xx:12298/
option transfer binary
get "MYSERVER/BACKUP 2017-09-25 (Incremental)" "c:\sftpbackup\BACKUP 2017-09-25"

All files copy (of any type) with no issue unless the total length path + file > 260.

Part of log file below on a particular file that failed..

. 2017-09-26 15:58:16.751 Cannot open remote file '/MYSERVER/BACKUP 2017-09-25 (Incremental)/Public Folder 12122-121 /My-Mketing_filelocation/PROJECTS/OlderPROJECTS/PROJECTS_2017/Three Rivers Community Center Central Holding & Processing, MD/Link to docs regarding all projects/Three Rivers Community Center Central Holding & Processing, Washington State, MD Summary Notice.doc'. ("Permission denied.
. 2017-09-26 15:58:16.751 Error code: 3
. 2017-09-26 15:58:16.751 Error message from server: Permission denied")

What can I do? Thanks..
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
SFTP protocol does not have any limitation of path length (neither FTP protocol does).
If your particular server has any limitation, it's a limitation of the particular server software.
(Unless you can prove that you do not have the problem with any other SFTP client)
buc

Guest


Thanks for the info, but it looks like none work with SFTP protocol, or that SFTP works period.. here are my tests (I may have done something wrong, so tell me please if I did. I've been know to overlook the obvious)

I used 2 different servers SFTP software (SolarWind and BVSSH) on Windows 2012R2 (I redid all these tests on Windows 10 machines as well).
I tried 3 different clients (WinSCP, FileZIlla, and BvSSH). All three fail BUT I see how to reproduce it. (I tried GUI and command line for the test).

If I drag a directory that has files / paths greater than 260 chars to the local disk C: root, All the files and directories copy EXCEPT any files that are in a path greater than 260 chars. I could reproduce this with each client connected to each server in separate tests. If I shorten the part of the particular path that has one of these files to < 260 chars total, the file then copies.

An additional test I did was to use robocopy to copy the same directory structure over to the client (including the long paths). I then tried using the SFTP clients GUI, navigating through the many subdirectories, and selecting the individual file > 260 chars deep and tried dragging it to the same directory location on the client. It fails as well. IF I drag it to a directory where it doesn't violate the 260 limit, the file copies.

I may be wrong, but this tells me SFTP can access/copy a file > 260, but it (either the client itself or the protocol, I don't know) can't WRITE the file to the same or another location (directory) where the total path length exceeds 260. I was attempting to write full/incremental backups so the dir structure has to remain the same, and to use a more secure way than robocopy (with its unsecure windows file services ports)

I am thoroughly confused now, as I was under the impression that SFTP can transfer long paths and files. I can easily set this long file scenario up and make it fail every time. I would greatly appreciate any insight on this matter, I may be overlooking something obvious.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
I'm not sure what are you trying to prove here.
There's no limitation in SFTP on path length.
Windows has a legacy limit of 260. The limit can be bypassed using some techniques, that a software has to explicitly employ. Software that does not employ these techniques is limited by those 260 characters. So if your server runs on Windows, it can potentially be limited. But that's limit of the software/Windows, not a limit of SFTP.
Though I was able to download a file with ~500 characters in path from Bitvise SSH server running on Windows without any problem.
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License