SFTP Path Length Error

Advertisement

Buc
Guest

SFTP Path Length Error

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: SFTP Path Length Error

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)

Reply with quote

buc
Guest

SFTP Path Length Error

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: SFTP Path Length Error

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.

Reply with quote

Advertisement

You can post new topics in this forum