2016-01-07 12 views
3

J'ai configuré un serveur SSH en tant que serveur SFTP avec Apache Mina SSHD. J'ai mis en œuvre mon propre FileSystemFactory, de sorte que des répertoires spécifiques sont créés pour l'utilisateur qui se connecte. Lorsque j'ouvre une connexion au serveur avec FileZilla, la structure du répertoire est mal affichée.Apache Mina SSHD - FileZilla affiche une structure de répertoire incorrecte

enter image description here

Dans la vue répertoire racine, un dossier vide est affiché. Celui-ci n'existe pas. Il devrait y avoir seulement deux répertoires. "Télécharger" et "Télécharger".

enter image description here

Quand j'ouvre le répertoire de téléchargement, je vois encore une fois un répertoire vide qui ne doit pas être affichée car elle n'existe pas. En outre, un autre répertoire de téléchargement est affiché. Je ne peux pas l'ouvrir, car il dit que/upload/upload n'existe pas, ce qui est vrai, mais je n'arrive pas à comprendre pourquoi il est affiché. Lorsque je me connecte avec WinSCP, je n'obtiens pas cette erreur d'affichage. Est-ce que quelqu'un sait pourquoi cela arrive ou comment le résoudre?

EDIT:

FileSystemFactory mise en œuvre:

public class CustomFileSystemFactory implements FileSystemFactory { 
    private String defaultHomeDir; 
    private FileSystem fileSystem; 

    public CustomFileSystemFactory(String defaultHomeDir){ 
    this.defaultHomeDir = defaultHomeDir; 
    } 

    public String getDefaultHome(){ 
    return defaultHomeDir; 
    } 

    public FileSystem getFileSystem(){ 
    return fileSystem; 
    } 

    @Override 
    public FileSystem createFileSystem(Session session) throws IOException { 
    Path dir = computeRootDir(session.getUsername()); 
    if (dir == null) { 
     throw new InvalidPathException(session.getUsername(), "Cannot resolve home directory"); 
    } 

    if(!Files.exists(dir)){ 
     Files.createDirectory(dir); 
    } 
    setupFolders(session.getUsername()); 
    FileSystem fileSystem = new RootedFileSystemProvider().newFileSystem(dir, Collections.emptyMap()); 
    return fileSystem; 
    } 

    protected Path computeRootDir(String username){ 
    Path path = Paths.get(defaultHomeDir + Utils.getPrincipalExtId(username) + "/"); 
    return path; 
    } 

    protected void setupFolders(String username) throws IOException { 
    Path homeDir = computeRootDir(username); 
    File uploadFolder = new File(homeDir + "/upload/"); 
    File downloadFolder = new File(homeDir + "/download/"); 
    if(!uploadFolder.exists()){ 
     uploadFolder.mkdirs(); 
    } 
    if(!downloadFolder.exists()){ 
     downloadFolder.mkdirs(); 
    } 
    } 
} 

C'est le WinSCP Connectez-Debug Niveau 2:

. 2016-01-07 14:46:46.909 Listing directory "/". 
> 2016-01-07 14:46:46.909 Type: SSH_FXP_OPENDIR, Size: 10, Number: 4107 
> 2016-01-07 14:46:46.909 0B,00,00,10,0B,00,00,00,01,2F, 
. 2016-01-07 14:46:46.909 Sent 14 bytes 
. 2016-01-07 14:46:46.909 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:46.909 Looking for network events 
. 2016-01-07 14:46:46.909 Timeout waiting for network events 
. 2016-01-07 14:46:46.909 Waiting for another 4 bytes 
. 2016-01-07 14:46:46.909 Looking for incoming data 
. 2016-01-07 14:46:46.909 Looking for network events 
. 2016-01-07 14:46:46.913 Detected network event 
. 2016-01-07 14:46:46.913 Enumerating network events for socket 1084 
. 2016-01-07 14:46:46.913 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:46.913 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:46.913 Received 45 bytes (0) 
. 2016-01-07 14:46:46.913 Read 4 bytes (41 pending) 
. 2016-01-07 14:46:46.913 Read 41 bytes (0 pending) 
< 2016-01-07 14:46:46.913 Type: SSH_FXP_HANDLE, Size: 41, Number: 4107 
< 2016-01-07 14:46:46.913 66,00,00,10,0B,00,00,00,20,34,34,30,63,33,34,36,32,62,30,34,65,39,37,32,61, 
< 2016-01-07 14:46:46.913 34,39,34,62,62,31,30,64,36,65,62,61,35,65,61,33, 
> 2016-01-07 14:46:46.913 Type: SSH_FXP_READDIR, Size: 41, Number: 4364 
> 2016-01-07 14:46:46.913 0C,00,00,11,0C,00,00,00,20,34,34,30,63,33,34,36,32,62,30,34,65,39,37,32,61, 
> 2016-01-07 14:46:46.913 34,39,34,62,62,31,30,64,36,65,62,61,35,65,61,33, 
. 2016-01-07 14:46:46.913 Sent 45 bytes 
. 2016-01-07 14:46:46.914 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:46.914 Looking for network events 
. 2016-01-07 14:46:46.914 Timeout waiting for network events 
. 2016-01-07 14:46:46.914 Waiting for another 4 bytes 
. 2016-01-07 14:46:46.914 Looking for incoming data 
. 2016-01-07 14:46:46.914 Looking for network events 
. 2016-01-07 14:46:46.924 Detected network event 
. 2016-01-07 14:46:46.924 Enumerating network events for socket 1084 
. 2016-01-07 14:46:46.924 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:46.924 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:46.925 Received 1113 bytes (0) 
. 2016-01-07 14:46:46.925 Read 4 bytes (1109 pending) 
. 2016-01-07 14:46:46.925 Read 1109 bytes (0 pending) 
< 2016-01-07 14:46:46.925 Type: SSH_FXP_NAME, Size: 1109, Number: 4364 
< 2016-01-07 14:46:46.925 68,00,00,11,0C,00,00,00,03,00,00,00,01,2E,00,00,00,7C,02,00,00,41,B6,00,00, 
< 2016-01-07 14:46:46.925 00,00,56,79,11,96,00,00,00,00,56,79,11,96,00,00,00,00,56,79,11,96,00,00,01, 
< 2016-01-07 14:46:46.925 37,00,00,00,07,00,00,00,00,00,00,00,00,00,1F,01,FF,00,00,00,1C,56,4F,52,44, 
< 2016-01-07 14:46:46.925 45,46,49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00, 
< 2016-01-07 14:46:46.925 00,00,00,00,00,00,0B,00,00,00,00,00,00,00,1C,56,4F,52,44,45,46,49,4E,49,45, 
< 2016-01-07 14:46:46.925 52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00,00,00,00,00,00,00, 
< 2016-01-07 14:46:46.925 00,00,1F,01,FF,00,00,00,14,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59, 
< 2016-01-07 14:46:46.925 53,54,45,4D,00,00,00,00,00,00,00,0B,00,00,00,00,00,00,00,14,4E,54,2D,41,55, 
< 2016-01-07 14:46:46.925 54,4F,52,49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00,00,00,00,00,00,03,00,12, 
< 2016-01-07 14:46:46.925 00,A9,00,00,00,15,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,42,65,6E,75,74,7A, 
< 2016-01-07 14:46:46.925 65,72,00,00,00,00,00,00,00,00,00,13,01,BF,00,00,00,27,4E,54,2D,41,55,54,4F, 
< 2016-01-07 14:46:46.925 52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65,72,74,65,20,42, 
< 2016-01-07 14:46:46.925 65,6E,75,74,7A,65,72,00,00,00,00,00,00,00,0B,00,01,00,00,00,00,00,27,4E,54, 
< 2016-01-07 14:46:46.925 2D,41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65, 
< 2016-01-07 14:46:46.925 72,74,65,20,42,65,6E,75,74,7A,65,72,00,00,00,08,64,6F,77,6E,6C,6F,61,64,00, 
< 2016-01-07 14:46:46.925 00,00,7C,02,00,00,41,B6,00,00,00,00,56,8E,52,55,00,00,00,00,56,8E,52,55,00, 
< 2016-01-07 14:46:46.925 00,00,00,56,8E,52,55,00,00,01,54,00,00,00,08,00,00,00,00,00,00,00,03,00,1F, 
< 2016-01-07 14:46:46.925 01,FF,00,00,00,0D,44,55,53,5C,6E,6D,65,63,6B,6D,61,6E,6E,00,00,00,00,00,00, 
< 2016-01-07 14:46:46.925 00,00,00,1F,01,FF,00,00,00,1C,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,41,64, 
< 2016-01-07 14:46:46.925 6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00,00,00,00,00,00,00,0B,00,00,00,00, 
< 2016-01-07 14:46:46.925 00,00,00,1C,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74, 
< 2016-01-07 14:46:46.925 72,61,74,6F,72,65,6E,00,00,00,00,00,00,00,00,00,1F,01,FF,00,00,00,14,4E,54, 
< 2016-01-07 14:46:46.925 2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00,00,00,00,00,00, 
< 2016-01-07 14:46:46.925 0B,00,00,00,00,00,00,00,14,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59, 
< 2016-01-07 14:46:46.925 53,54,45,4D,00,00,00,00,00,00,00,03,00,12,00,A9,00,00,00,15,56,4F,52,44,45, 
< 2016-01-07 14:46:46.925 46,49,4E,49,45,52,54,5C,42,65,6E,75,74,7A,65,72,00,00,00,00,00,00,00,00,00, 
< 2016-01-07 14:46:46.925 13,01,BF,00,00,00,27,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68, 
< 2016-01-07 14:46:46.925 65,6E,74,69,66,69,7A,69,65,72,74,65,20,42,65,6E,75,74,7A,65,72,00,00,00,00, 
< 2016-01-07 14:46:46.925 00,00,00,0B,00,01,00,00,00,00,00,27,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54, 
< 2016-01-07 14:46:46.925 5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65,72,74,65,20,42,65,6E,75,74,7A,65, 
< 2016-01-07 14:46:46.925 72,00,00,00,06,75,70,6C,6F,61,64,00,00,00,7C,02,00,00,41,B6,00,00,00,00,56, 
< 2016-01-07 14:46:46.925 8E,51,ED,00,00,00,00,56,8E,51,ED,00,00,00,00,56,8E,51,ED,00,00,01,37,00,00, 
< 2016-01-07 14:46:46.925 00,07,00,00,00,00,00,00,00,00,00,1F,01,FF,00,00,00,1C,56,4F,52,44,45,46,49, 
< 2016-01-07 14:46:46.925 4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00,00,00,00, 
< 2016-01-07 14:46:46.925 00,00,00,0B,00,00,00,00,00,00,00,1C,56,4F,52,44,45,46,49,4E,49,45,52,54,5C, 
< 2016-01-07 14:46:46.925 41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00,00,00,00,00,00,00,00,00,1F, 
< 2016-01-07 14:46:46.925 01,FF,00,00,00,14,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59,53,54,45, 
< 2016-01-07 14:46:46.925 4D,00,00,00,00,00,00,00,0B,00,00,00,00,00,00,00,14,4E,54,2D,41,55,54,4F,52, 
< 2016-01-07 14:46:46.925 49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00,00,00,00,00,00,03,00,12,00,A9,00, 
< 2016-01-07 14:46:46.925 00,00,15,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,42,65,6E,75,74,7A,65,72,00, 
< 2016-01-07 14:46:46.925 00,00,00,00,00,00,00,00,13,01,BF,00,00,00,27,4E,54,2D,41,55,54,4F,52,49,54, 
< 2016-01-07 14:46:46.925 C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65,72,74,65,20,42,65,6E,75, 
< 2016-01-07 14:46:46.925 74,7A,65,72,00,00,00,00,00,00,00,0B,00,01,00,00,00,00,00,27,4E,54,2D,41,55, 
< 2016-01-07 14:46:46.926 54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65,72,74,65, 
< 2016-01-07 14:46:46.926 20,42,65,6E,75,74,7A,65,72, 
> 2016-01-07 14:46:46.926 Type: SSH_FXP_READDIR, Size: 41, Number: 4620 
> 2016-01-07 14:46:46.926 0C,00,00,12,0C,00,00,00,20,34,34,30,63,33,34,36,32,62,30,34,65,39,37,32,61, 
> 2016-01-07 14:46:46.926 34,39,34,62,62,31,30,64,36,65,62,61,35,65,61,33, 
. 2016-01-07 14:46:46.926 Sent 45 bytes 
. 2016-01-07 14:46:46.926 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:46.926 Looking for network events 
. 2016-01-07 14:46:46.926 Timeout waiting for network events 
. 2016-01-07 14:46:46.926 Read file '.' from listing 
. 2016-01-07 14:46:46.926 Read file 'download' from listing 
. 2016-01-07 14:46:46.926 Read file 'upload' from listing 
. 2016-01-07 14:46:46.926 Waiting for another 4 bytes 
. 2016-01-07 14:46:46.926 Looking for incoming data 
. 2016-01-07 14:46:46.926 Looking for network events 
. 2016-01-07 14:46:46.926 Detected network event 
. 2016-01-07 14:46:46.926 Enumerating network events for socket 1084 
. 2016-01-07 14:46:46.926 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:46.926 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:46.926 Received 46 bytes (0) 
. 2016-01-07 14:46:46.926 Read 4 bytes (42 pending) 
. 2016-01-07 14:46:46.926 Read 42 bytes (0 pending) 
< 2016-01-07 14:46:46.926 Type: SSH_FXP_STATUS, Size: 42, Number: 4620 
< 2016-01-07 14:46:46.926 65,00,00,12,0C,00,00,00,01,00,00,00,19,44,69,72,65,63,74,6F,72,79,20,72,65, 
< 2016-01-07 14:46:46.926 61,64,69,6E,67,20,69,73,20,64,6F,6E,65,00,00,00,00, 
< 2016-01-07 14:46:46.926 Status code: 1 
> 2016-01-07 14:46:46.926 Type: SSH_FXP_CLOSE, Size: 41, Number: 4868 
> 2016-01-07 14:46:46.926 04,00,00,13,04,00,00,00,20,34,34,30,63,33,34,36,32,62,30,34,65,39,37,32,61, 
> 2016-01-07 14:46:46.926 34,39,34,62,62,31,30,64,36,65,62,61,35,65,61,33, 
. 2016-01-07 14:46:46.926 Sent 45 bytes 
. 2016-01-07 14:46:46.926 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:46.926 Looking for network events 
. 2016-01-07 14:46:46.926 Timeout waiting for network events 
. 2016-01-07 14:46:46.927 download;D;0;2016-01-07T11:56:05.000Z;"" [0];"" [0];rw-rw-rw-;1 
. 2016-01-07 14:46:46.927 upload;D;0;2016-01-07T11:54:21.000Z;"" [0];"" [0];rw-rw-rw-;1 
. 2016-01-07 14:46:47.009 Startup conversation with host finished. 
. 2016-01-07 14:46:47.122 Session upkeep 
. 2016-01-07 14:46:47.122 Looking for network events 
. 2016-01-07 14:46:47.122 Detected network event 
. 2016-01-07 14:46:47.122 Enumerating network events for socket 1084 
. 2016-01-07 14:46:47.122 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:47.122 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:47.122 Received 21 bytes (0) 
. 2016-01-07 14:46:47.124 Session upkeep 
. 2016-01-07 14:46:47.124 Looking for network events 
. 2016-01-07 14:46:47.124 Timeout waiting for network events 
. 2016-01-07 14:46:47.257 Session upkeep 
. 2016-01-07 14:46:47.257 Looking for network events 
. 2016-01-07 14:46:47.257 Timeout waiting for network events 
. 2016-01-07 14:46:47.768 Session upkeep 
. 2016-01-07 14:46:47.768 Looking for network events 
. 2016-01-07 14:46:47.768 Timeout waiting for network events 
. 2016-01-07 14:46:48.267 Session upkeep 
. 2016-01-07 14:46:48.267 Looking for network events 
. 2016-01-07 14:46:48.267 Timeout waiting for network events 
. 2016-01-07 14:46:48.781 Session upkeep 
. 2016-01-07 14:46:48.782 Looking for network events 
. 2016-01-07 14:46:48.782 Timeout waiting for network events 
. 2016-01-07 14:46:48.832 Cached directory change via "download" to "/download". 
. 2016-01-07 14:46:48.832 Getting current directory name. 
. 2016-01-07 14:46:48.832 Listing directory "/download". 
> 2016-01-07 14:46:48.832 Type: SSH_FXP_OPENDIR, Size: 18, Number: 5131 
> 2016-01-07 14:46:48.832 0B,00,00,14,0B,00,00,00,09,2F,64,6F,77,6E,6C,6F,61,64, 
. 2016-01-07 14:46:48.832 Sent 22 bytes 
. 2016-01-07 14:46:48.832 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:48.832 Looking for network events 
. 2016-01-07 14:46:48.834 Timeout waiting for network events 
. 2016-01-07 14:46:48.834 Read 4 bytes (17 pending) 
. 2016-01-07 14:46:48.834 Read 17 bytes (0 pending) 
< 2016-01-07 14:46:48.834 Type: SSH_FXP_STATUS, Size: 17, Number: 4868 
< 2016-01-07 14:46:48.834 65,00,00,13,04,00,00,00,00,00,00,00,00,00,00,00,00, 
. 2016-01-07 14:46:48.834 Discarding reserved response 
. 2016-01-07 14:46:48.834 Waiting for another 4 bytes 
. 2016-01-07 14:46:48.834 Looking for incoming data 
. 2016-01-07 14:46:48.834 Looking for network events 
. 2016-01-07 14:46:48.834 Detected network event 
. 2016-01-07 14:46:48.834 Enumerating network events for socket 1084 
. 2016-01-07 14:46:48.834 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:48.834 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:48.834 Received 45 bytes (0) 
. 2016-01-07 14:46:48.834 Read 4 bytes (41 pending) 
. 2016-01-07 14:46:48.834 Read 41 bytes (0 pending) 
< 2016-01-07 14:46:48.834 Type: SSH_FXP_HANDLE, Size: 41, Number: 5131 
< 2016-01-07 14:46:48.834 66,00,00,14,0B,00,00,00,20,30,61,33,38,32,30,37,31,37,64,61,65,34,34,39,61, 
< 2016-01-07 14:46:48.834 30,31,66,36,32,65,35,61,33,34,65,34,30,33,39,34, 
> 2016-01-07 14:46:48.834 Type: SSH_FXP_READDIR, Size: 41, Number: 5388 
> 2016-01-07 14:46:48.834 0C,00,00,15,0C,00,00,00,20,30,61,33,38,32,30,37,31,37,64,61,65,34,34,39,61, 
> 2016-01-07 14:46:48.834 30,31,66,36,32,65,35,61,33,34,65,34,30,33,39,34, 
. 2016-01-07 14:46:48.835 Sent 45 bytes 
. 2016-01-07 14:46:48.835 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:48.835 Looking for network events 
. 2016-01-07 14:46:48.835 Timeout waiting for network events 
. 2016-01-07 14:46:48.835 Waiting for another 4 bytes 
. 2016-01-07 14:46:48.835 Looking for incoming data 
. 2016-01-07 14:46:48.835 Looking for network events 
. 2016-01-07 14:46:48.840 Detected network event 
. 2016-01-07 14:46:48.840 Enumerating network events for socket 1084 
. 2016-01-07 14:46:48.840 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:48.840 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:48.840 Received 749 bytes (0) 
. 2016-01-07 14:46:48.840 Read 4 bytes (745 pending) 
. 2016-01-07 14:46:48.840 Read 745 bytes (0 pending) 
< 2016-01-07 14:46:48.840 Type: SSH_FXP_NAME, Size: 745, Number: 5388 
< 2016-01-07 14:46:48.840 68,00,00,15,0C,00,00,00,02,00,00,00,01,2E,00,00,00,7C,02,00,00,41,B6,00,00, 
< 2016-01-07 14:46:48.840 00,00,56,8E,52,55,00,00,00,00,56,8E,52,55,00,00,00,00,56,8E,52,55,00,00,01, 
< 2016-01-07 14:46:48.840 54,00,00,00,08,00,00,00,00,00,00,00,03,00,1F,01,FF,00,00,00,0D,44,55,53,5C, 
< 2016-01-07 14:46:48.840 6E,6D,65,63,6B,6D,61,6E,6E,00,00,00,00,00,00,00,00,00,1F,01,FF,00,00,00,1C, 
< 2016-01-07 14:46:48.840 56,4F,52,44,45,46,49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F, 
< 2016-01-07 14:46:48.840 72,65,6E,00,00,00,00,00,00,00,0B,00,00,00,00,00,00,00,1C,56,4F,52,44,45,46, 
< 2016-01-07 14:46:48.840 49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65,6E,00,00,00, 
< 2016-01-07 14:46:48.840 00,00,00,00,00,00,1F,01,FF,00,00,00,14,4E,54,2D,41,55,54,4F,52,49,54,C3,84, 
< 2016-01-07 14:46:48.840 54,5C,53,59,53,54,45,4D,00,00,00,00,00,00,00,0B,00,00,00,00,00,00,00,14,4E, 
< 2016-01-07 14:46:48.840 54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00,00,00,00,00, 
< 2016-01-07 14:46:48.840 00,03,00,12,00,A9,00,00,00,15,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,42,65, 
< 2016-01-07 14:46:48.840 6E,75,74,7A,65,72,00,00,00,00,00,00,00,00,00,13,01,BF,00,00,00,27,4E,54,2D, 
< 2016-01-07 14:46:48.840 41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69,7A,69,65,72, 
< 2016-01-07 14:46:48.840 74,65,20,42,65,6E,75,74,7A,65,72,00,00,00,00,00,00,00,0B,00,01,00,00,00,00, 
< 2016-01-07 14:46:48.840 00,27,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66, 
< 2016-01-07 14:46:48.840 69,7A,69,65,72,74,65,20,42,65,6E,75,74,7A,65,72,00,00,00,02,2E,2E,00,00,00, 
< 2016-01-07 14:46:48.840 7C,02,00,00,41,B6,00,00,00,00,56,79,11,96,00,00,00,00,56,79,11,96,00,00,00, 
< 2016-01-07 14:46:48.840 00,56,79,11,96,00,00,01,37,00,00,00,07,00,00,00,00,00,00,00,00,00,1F,01,FF, 
< 2016-01-07 14:46:48.840 00,00,00,1C,56,4F,52,44,45,46,49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74, 
< 2016-01-07 14:46:48.840 72,61,74,6F,72,65,6E,00,00,00,00,00,00,00,0B,00,00,00,00,00,00,00,1C,56,4F, 
< 2016-01-07 14:46:48.840 52,44,45,46,49,4E,49,45,52,54,5C,41,64,6D,69,6E,69,73,74,72,61,74,6F,72,65, 
< 2016-01-07 14:46:48.840 6E,00,00,00,00,00,00,00,00,00,1F,01,FF,00,00,00,14,4E,54,2D,41,55,54,4F,52, 
< 2016-01-07 14:46:48.840 49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00,00,00,00,00,00,0B,00,00,00,00,00, 
< 2016-01-07 14:46:48.840 00,00,14,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,53,59,53,54,45,4D,00,00, 
< 2016-01-07 14:46:48.840 00,00,00,00,00,03,00,12,00,A9,00,00,00,15,56,4F,52,44,45,46,49,4E,49,45,52, 
< 2016-01-07 14:46:48.840 54,5C,42,65,6E,75,74,7A,65,72,00,00,00,00,00,00,00,00,00,13,01,BF,00,00,00, 
< 2016-01-07 14:46:48.840 27,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65,6E,74,69,66,69, 
< 2016-01-07 14:46:48.840 7A,69,65,72,74,65,20,42,65,6E,75,74,7A,65,72,00,00,00,00,00,00,00,0B,00,01, 
< 2016-01-07 14:46:48.840 00,00,00,00,00,27,4E,54,2D,41,55,54,4F,52,49,54,C3,84,54,5C,41,75,74,68,65, 
< 2016-01-07 14:46:48.841 6E,74,69,66,69,7A,69,65,72,74,65,20,42,65,6E,75,74,7A,65,72, 
> 2016-01-07 14:46:48.841 Type: SSH_FXP_READDIR, Size: 41, Number: 5644 
> 2016-01-07 14:46:48.841 0C,00,00,16,0C,00,00,00,20,30,61,33,38,32,30,37,31,37,64,61,65,34,34,39,61, 
> 2016-01-07 14:46:48.841 30,31,66,36,32,65,35,61,33,34,65,34,30,33,39,34, 
. 2016-01-07 14:46:48.841 Sent 45 bytes 
. 2016-01-07 14:46:48.841 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:48.841 Looking for network events 
. 2016-01-07 14:46:48.841 Timeout waiting for network events 
. 2016-01-07 14:46:48.841 Read file '.' from listing 
. 2016-01-07 14:46:48.841 Read file '..' from listing 
. 2016-01-07 14:46:48.841 Waiting for another 4 bytes 
. 2016-01-07 14:46:48.841 Looking for incoming data 
. 2016-01-07 14:46:48.841 Looking for network events 
. 2016-01-07 14:46:48.841 Detected network event 
. 2016-01-07 14:46:48.841 Enumerating network events for socket 1084 
. 2016-01-07 14:46:48.841 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:48.841 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:48.841 Received 46 bytes (0) 
. 2016-01-07 14:46:48.841 Read 4 bytes (42 pending) 
. 2016-01-07 14:46:48.841 Read 42 bytes (0 pending) 
< 2016-01-07 14:46:48.841 Type: SSH_FXP_STATUS, Size: 42, Number: 5644 
< 2016-01-07 14:46:48.841 65,00,00,16,0C,00,00,00,01,00,00,00,19,44,69,72,65,63,74,6F,72,79,20,72,65, 
< 2016-01-07 14:46:48.841 61,64,69,6E,67,20,69,73,20,64,6F,6E,65,00,00,00,00, 
< 2016-01-07 14:46:48.842 Status code: 1 
> 2016-01-07 14:46:48.842 Type: SSH_FXP_CLOSE, Size: 41, Number: 5892 
> 2016-01-07 14:46:48.842 04,00,00,17,04,00,00,00,20,30,61,33,38,32,30,37,31,37,64,61,65,34,34,39,61, 
> 2016-01-07 14:46:48.842 30,31,66,36,32,65,35,61,33,34,65,34,30,33,39,34, 
. 2016-01-07 14:46:48.842 Sent 45 bytes 
. 2016-01-07 14:46:48.842 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:48.842 Looking for network events 
. 2016-01-07 14:46:48.842 Timeout waiting for network events 
. 2016-01-07 14:46:48.842 ..;D;0;2015-12-22T09:02:14.000Z;"" [0];"" [0];rw-rw-rw-;1 
. 2016-01-07 14:46:49.283 Session upkeep 
. 2016-01-07 14:46:49.283 Looking for network events 
. 2016-01-07 14:46:49.283 Detected network event 
. 2016-01-07 14:46:49.283 Enumerating network events for socket 1084 
. 2016-01-07 14:46:49.283 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:49.283 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:49.283 Received 21 bytes (0) 
. 2016-01-07 14:46:49.472 Cached directory change via ".." to "/". 
. 2016-01-07 14:46:49.472 Getting current directory name. 
. 2016-01-07 14:46:49.473 Directory content loaded from cache. 
. 2016-01-07 14:46:49.795 Session upkeep 
. 2016-01-07 14:46:49.795 Looking for network events 
. 2016-01-07 14:46:49.795 Timeout waiting for network events 
. 2016-01-07 14:46:49.880 Cached directory change via "upload" to "/upload". 
. 2016-01-07 14:46:49.880 Getting current directory name. 
. 2016-01-07 14:46:49.881 Listing directory "/upload". 
> 2016-01-07 14:46:49.881 Type: SSH_FXP_OPENDIR, Size: 16, Number: 6155 
> 2016-01-07 14:46:49.881 0B,00,00,18,0B,00,00,00,07,2F,75,70,6C,6F,61,64, 
. 2016-01-07 14:46:49.881 Sent 20 bytes 
. 2016-01-07 14:46:49.881 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:49.881 Looking for network events 
. 2016-01-07 14:46:49.882 Timeout waiting for network events 
. 2016-01-07 14:46:49.882 Read 4 bytes (17 pending) 
. 2016-01-07 14:46:49.882 Read 17 bytes (0 pending) 
< 2016-01-07 14:46:49.882 Type: SSH_FXP_STATUS, Size: 17, Number: 5892 
< 2016-01-07 14:46:49.882 65,00,00,17,04,00,00,00,00,00,00,00,00,00,00,00,00, 
. 2016-01-07 14:46:49.882 Discarding reserved response 
. 2016-01-07 14:46:49.882 Waiting for another 4 bytes 
. 2016-01-07 14:46:49.882 Looking for incoming data 
. 2016-01-07 14:46:49.882 Looking for network events 
. 2016-01-07 14:46:49.882 Detected network event 
. 2016-01-07 14:46:49.882 Enumerating network events for socket 1084 
. 2016-01-07 14:46:49.883 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:49.883 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:49.883 Received 45 bytes (0) 
. 2016-01-07 14:46:49.883 Read 4 bytes (41 pending) 
. 2016-01-07 14:46:49.883 Read 41 bytes (0 pending) 
< 2016-01-07 14:46:49.883 Type: SSH_FXP_HANDLE, Size: 41, Number: 6155 
< 2016-01-07 14:46:49.883 66,00,00,18,0B,00,00,00,20,30,38,61,36,35,34,38,66,61,36,39,63,66,31,64,37, 
< 2016-01-07 14:46:49.883 65,31,33,34,32,33,63,32,61,30,32,30,35,33,63,37, 
> 2016-01-07 14:46:49.883 Type: SSH_FXP_READDIR, Size: 41, Number: 6412 
> 2016-01-07 14:46:49.883 0C,00,00,19,0C,00,00,00,20,30,38,61,36,35,34,38,66,61,36,39,63,66,31,64,37, 
> 2016-01-07 14:46:49.883 65,31,33,34,32,33,63,32,61,30,32,30,35,33,63,37, 
. 2016-01-07 14:46:49.883 Sent 45 bytes 
. 2016-01-07 14:46:49.883 There are 0 bytes remaining in the send buffer 
. 2016-01-07 14:46:49.883 Looking for network events 
. 2016-01-07 14:46:49.883 Timeout waiting for network events 
. 2016-01-07 14:46:49.883 Waiting for another 4 bytes 
. 2016-01-07 14:46:49.883 Looking for incoming data 
. 2016-01-07 14:46:49.883 Looking for network events 
. 2016-01-07 14:46:49.889 Detected network event 
. 2016-01-07 14:46:49.890 Enumerating network events for socket 1084 
. 2016-01-07 14:46:49.890 Enumerated 1 network events making 1 cumulative events for socket 1084 
. 2016-01-07 14:46:49.890 Handling network read event on socket 1084 with error 0 
. 2016-01-07 14:46:49.890 Received 720 bytes (0) 
. 2016-01-07 14:46:49.890 Read 4 bytes (716 pending) 
. 2016-01-07 14:46:49.890 Read 716 bytes (0 pending) 

Salutations

+0

Montrez-nous un fichier journal de session à partir de WinSCP et FileZilla (un vrai fichier journal, pas le journal des messages de l'interface graphique). –

+0

J'ai ajouté les deux fichiers journaux. J'espère que c'est ce que tu voulais voir? – nlsn

+0

Désolé, je ne me suis pas rendu compte que c'est SFTP, de sorte que la liste ne sera pas vu dans le journal ordinaire. Pouvez-vous ajouter "Debug 2" journal de niveau de WinSCP? Montrez-nous aussi le code de votre système de fichiers. –

Répondre

1

Le problème est résolu dans Apache Mina SSHD 1.1.0, voir


Garder la solution pour les versions antérieures:

Le problème est en partie sur les deux côtés, le serveur Mina SSHD et le client FileZilla.

Dans la version 3 SFTP (qui utilise FileZilla), une entrée pour chaque fichier contient à la fois des métadonnées structurées et une chaîne d'affichage uniquement (alias longname champ) avec un format similaire à la commande * nix ls -l. Cette chaîne d'affichage uniquement ne doit pas être analysée.

Mais FileZilla l'analyse, au lieu d'utiliser les métadonnées structurées (sauf pour un horodatage de fichier). Un processus psftp interne qui FileZilla utilise pour mettre en oeuvre le protocole SFTP ne fournit cette information à un processus FileZilla parent (une fonction sftp_cmd_ls):

if (ournames[i]->attrs.flags & SSH_FILEXFER_ATTR_ACMODTIME) { 
    mtime = ournames[i]->attrs.mtime; 
} 
fzprintf(sftpListentry, "%lu %s", mtime, ournames[i]->longname); 

La Mina SSHD/SFTP (la classe SftpSubsystem), lors de l'inscription du . et .. méta-répertoires, utilise de manière incorrecte un nom de dossier actuel et un nom de dossier parent dans la chaîne d'affichage uniquement, au lieu de . et ... Il utilise correctement les . et .. dans le medata structuré (un champ shortname).


FileZilla lit les noms erronés de la liste et s'embrouille, traiter les entrées comme les entrées du sous-répertoire réel, au lieu des méta-répertoires. Dans le répertoire racine, les codes . et .. sont probablement répertoriés comme /. FileZilla supprime tout jusqu'à la dernière /, ce qui conduit à l'entrée vide (et les deux entrées nommées [empty-named] sont probablement fusionnées en une seule).

Ainsi, au lieu de

. 
.. 
upload 
download 

le FileZilla voit

/ [treated as an empty string] 
/[treated as an empty string and ignored as duplicate] 
upload 
download 

Dans le répertoire upload, le . est répertorié comme upload et .. comme / (menant à l'entrée vide).

Ainsi, au lieu de

. 
.. 

le FileZilla voit

upload 
/[treated as an empty string] 

WinSCP, au contraire, utilise jamais la chaîne d'affichage uniquement pour résoudre le nom de fichier/répertoire. Et principalement (si le serveur supporte cela, ce que fait Mina SSHD) utilise la version 4 de SFTP, cela n'inclut même pas la chaîne d'affichage seulement.


Pour résoudre le problème, vous devez passer un paramètre shortName de SftpSubsystem.writeDirEntry méthode à la méthode appelée .getLongName. Et modifiez le .getLongName pour utiliser shortName dans la chaîne qu'il renvoie au lieu de getShortName(f).

Voir ci-dessous un code modifié de SftpSubsystem avec des commentaires décrivant les changements. Le code est de Mina SSHD la version 1,0

protected void writeDirEntry(int id, DirectoryHandle dir, Buffer buffer, int index, Path f, String shortName, LinkOption... options) throws IOException { 
    ... 
    if (version == SFTP_V3) { 
     // added shortName argument 
     String longName = getLongName(f, options, shortName); 
    } else { 
    ... 
} 

// added shortName parameter 
protected String getLongName(Path f, LinkOption... options, String shortName) throws IOException { 
    // added shortName argument 
    return getLongName(f, true, options, shortName); 
} 

// added shortName parameter 
private String getLongName(Path f, boolean sendAttrs, LinkOption... options, String shortName) throws IOException { 
    ... 
    // added shortName argument 
    return getLongName(f, attributes, shortName); 
} 

// added shortName parameter 
private String getLongName(Path f, Map<String, ?> attributes, String shortName) throws IOException { 
    ... 
    return (SftpHelper.getBool(isDirectory) ? "d" : (SftpHelper.getBool(isLink) ? "l" : "-")) 
      + PosixFilePermissions.toString(perms) + " " 
      + (attributes.containsKey("nlink") ? attributes.get("nlink") : "1") 
      + " " + username + " " + group + " " + lengthString + " " 
      + UnixDateFormat.getUnixDate((FileTime) attributes.get("lastModifiedTime")) 
      // using shortName instead of getShortName(f) 
      + " " + shortName; 
} 

// + you need to modify sendPath to pass getShortName(f) 
// to its call to getLongName 

Je ne fais pas Java, donc excuse un code cassé.


Tenir compte un rapport de bogue au projet Mina SSHD. Reliez le problème ici, si vous le faites.

+1

Merci pour votre temps. Cela semble fonctionner. :) J'ai également signalé cela au projet Apache Mina SSHD. https://issues.apache.org/jira/browse/SSHD-622 – nlsn