In my application I have 2 requirements with 2 different remote server:
- I have to copy a file from localhost to Remote Server X
- copy a different file from Remote Server Y to localhost
I am aware that Jsch can be used like below:
JSch jsch = new JSch();
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
jsch.addIdentity(privateKey, privateKeyPassphrase);
Session session = jsch.getSession(user, host, port);
session.setConfig(config);
session.connect(5000);
Using the above code I can connect a session for single host.How can I ge the different session to different hosts (in my case x and y) ?
Do I need the private key or public key of remote host whether I am copying to or from it ?
Regards