Discussion:
Commons VFS 2.2, SFTP, and ProxyCommand
(too old to reply)
Scott Dudley
2018-07-05 20:33:09 UTC
Permalink
Can someone direct me to a code fragment or example of how to proxy an SFTP connection through an SSH host.  I'm able to do the following via shell:

sftp -o "ProxyCommand=ssh -e none ***@host1 exec /bin/nc %h %p 2>/dev/null" ***@host2/path


The following was my initial, failed attempt:



            FileSystemManager fsm = VFS.getManager();

            FileSystemOptions opts = new FileSystemOptions();
            StaticUserAuthenticator auth = new StaticUserAuthenticator(null, "user2", "password2");
            DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
            
            SftpFileSystemConfigBuilder builder = SftpFileSystemConfigBuilder.getInstance();
            builder.setProxyHost(opts, "host1");
            builder.setProxyUser(opts, "user1");
            builder.setProxyPassword(opts, "password1");
            
            FileObject fo = fsm.resolveFile("sftp://user2:***@host2/path", opts);


Thanks.
--------------------------------------------------------------------------------------------------------------------------------------------------
This message is for the designated recipient(s) only and may contain privileged, proprietary, and/or confidential information.
If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
Any views or opinions expressed are solely those of the author and do not necessarily represent those of MDSL.
--------------------------------------------------------------------------------------------------------------------------------------------------
Loading...