Closed albertoandreottiATgmail closed 4 years ago
@albertoandreottiATgmail , ChannelSftp
is using the sftp ssh subsystem, whereas this filesystem implementation uses the exec
subsystem. The exec
subsystem is actually executing the command:
ls -A -1 "/test336"
as if you actually ran:
ssh user@server ls -A -1 "/test336"
So it could be that your destination does not support ls -A -1
, is that possible? It also seems odd that it is /test336
, how did you obtain your fs
object? Did you set it up as follows?
URI uri = new URI( "ssh.unix://" + username + "@" + hostname + ":" + port + "/home/joe" );
try (FileSystem sshfs = FileSystems.newFileSystem( uri, environment )) {
Path path = sshfs.getPath( "afile" ); // refers to /home/joe/afile
try (InputStream inputStream = path.getFileSystem().provider().newInputStream( path )) {
String fileContents = IOUtils.copyToString( inputStream );
}
}
If you did, the path should have looked like: /home/joe/test336
...
Hi Lucas,
thanks for the answer. I tried to connect alternatively using sftp command line utility, and it seems that the "-A" switch is not supported. However, this command,
ssh user@server ls -1 "/test336"
is not working at all. In case this is useful for debugging,
sftp> version SFTP protocol version 3
Alberto.
@albertoandreottiATgmail , are you sure ssh exec
subsystem is available? It sounds like your destination server may be sftp
subsystem only. That is relatively common scenario... Can you even:
ssh user@server
Does that drop you into a shell of some sort?
This project does not currently support using the sftp
subsystem.
Hello Lucas,
thanks again for your answer, and no, the shell is not working. Is this something I can ask to be added to the server administrator?
thanks!
@albertoandreottiATgmail , you can ask. It's just a configuration option on the server. But when they only allow sftp, its often for security reasons. It will really be up to them.
I'm gonna close this issue as Invalid given that its simply that you do not have the exec
subsystem.
Hello,
I'm trying to run the most basic of the operations, first I create a folder, and then I try to list its contents. It's failing with the following,
The same thing happens for a folder that was already there, here's the code,
When debugging, I managed to talk directly to the (ChannelSftp)sftp object and call ls(), and it worked. So there's some wrapping that must be broken. Alberto.