You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "GabriRuflex (via GitHub)" <gi...@apache.org> on 2025/10/25 12:04:44 UTC
Re: [I] FileSystemProvider ignores provided environment parameters when creating the default SshClient [mina-sshd]
GabriRuflex commented on issue #847:
URL: https://github.com/apache/mina-sshd/issues/847#issuecomment-3446620044
@tomaswolf I updated the title and the description.
The problem was simple (though not obvious to me, thanks for the help): even though I had defined the auth methods in the environment parameters, the FileSystemProvider ignored them, causing too many connection attempts and the server resetting the connection.
Defining the SshClient separately and then passing it to SftpFileSystemProvider worked for me.
IMHO, it would be much more convenient if the `FileSystemProvider` could respect the environment parameters directly.
This would avoid additional boilerplate code, making the code more readable and maintainable.
This code worked for me:
```
try (SshClient client = SshClient.setUpDefaultClient()) {
client.setUserAuthFactories(Collections.singletonList(UserAuthPasswordFactory.INSTANCE));
client.start();
try (FileSystem fs = new SftpFileSystemProvider(client)
.newFileSystem(uri, Collections.emptyMap())) {
...
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org