SFTP symlink resolution

Need help with FileZilla Client? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
rasavibes
500 Command not understood
Posts: 2
Joined: 2019-09-28 13:44

SFTP symlink resolution

#1 Post by rasavibes » 2019-09-28 14:02

Hello,

First of all, I would like to thank developers for the great application.
I have been experiencing the following behavior using SFTP connections: symlinks are always treated like folders, even when they point to files.

on my server I did the following test:

$ mkdir folder
$ touch file
$ ln -sf file link_to_file
$ ln -sf folder link_to_folder
$ ls -lrt
total 0
drwxr-xr-x 1 thomas thomas 4096 Sep 28 15:58 folder
-rw-r--r-- 1 thomas thomas 0 Sep 28 15:58 file
lrwxrwxrwx 1 thomas thomas 4 Sep 28 15:58 link_to_file -> file
lrwxrwxrwx 1 thomas thomas 6 Sep 28 15:58 link_to_folder -> folder

Then I connect to that folder with Filezilla and list:
Listing: drwxr-xr-x 1 thomas thomas 4096 Sep 28 15:58 .
Listing: drwxr-xr-x 1 thomas thomas 4096 Sep 28 15:57 ..
Listing: -rw-r--r-- 1 thomas thomas 0 Sep 28 15:58 file
Listing: drwxr-xr-x 1 thomas thomas 4096 Sep 28 15:58 folder
Listing: lrwxrwxrwx 1 thomas thomas 4 Sep 28 15:58 link_to_file
Listing: lrwxrwxrwx 1 thomas thomas 6 Sep 28 15:58 link_to_folder


The server seems to provide a consistent output to the client.

However, Filezilla will display both links as "folder with an arrow".
The symlink "link_to_folder" behaves fine, it is followed fine and points toward folder
The problem occurs with link_to_file, which is handled as a folder.

Status: Retrieving directory listing of "/home/thomas/test/link_to_file"...
Command: cd "/home/thomas/test/link_to_file"
Error: Directory /home/thomas/test/file: no such file or directory
Error: Failed to retrieve directory listing

The symlink to file shall be resolved as such and treated like a file, no ?

thanks

User avatar
botg
Site Admin
Posts: 35507
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: SFTP symlink resolution

#2 Post by botg » 2019-09-30 07:19

Unfortunately from a protocol perspective, a link to a file cannot be distinguished from a link to a directory. Only when actually trying to access the link this distinction can be made.

FileZilla treats all links as directory links by default and only when switching into the target directory fails, it falls back to treating the link as a file.

rasavibes
500 Command not understood
Posts: 2
Joined: 2019-09-28 13:44

Re: SFTP symlink resolution

#3 Post by rasavibes » 2019-09-30 19:44

Hello,

Thanks for the feedback.
However when I try to access the file I get an error, as I mentioned in my post.
I try winscp in the same environment and it behaves correctly.
Maybe it would be possible to implement an optional symlink resolution mechanism ?
At lest the fact that the symlink gets properly resolved at access time is not working for me

User avatar
botg
Site Admin
Posts: 35507
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: SFTP symlink resolution

#4 Post by botg » 2019-09-30 20:59

Directories may contain hundreds of thousands of symbolic links. It's not feasible to stat them a the time of listing.

PS: Don't even try to use WinSCP with such large directories FileZilla handles with ease, it'll simply fail

Post Reply