There are methods "setPassword" in class Session for you to use.

Regards,
Viet

--- On Sun, 5/9/10, Abhishek Srivastava <[email protected]> wrote:

From: Abhishek Srivastava <[email protected]>
Subject: [JSch-users] Very basic SFTP question
To: [email protected]
Date: Sunday, May 9, 2010, 2:56 AM

My first post. Few hours ago my customer told me to sFTP a file instead of ftp.
I stumbled upon Jsch library and wrote the following code
private void sftpToDestination() throws JSchException, SftpException
{       JSch jsch = new JSch(); Session session = jsch.getSession(sftpUser, 
sftpAddress, sftpPort);
        session.connect();      Channel channel = session.openChannel("sftp");
        channel.connect();      ChannelSftp c = (ChannelSftp) channel;  
c.put("export.zip", "export.zip");              
        channel.disconnect();           session.disconnect();
}
Everything is fine except that I wonder where do I pass the password to 
establish a connection. Or does sFTP use something else instead of a password 
which I am missing here.

I don't know much about sFTP protocol or Jsch 

-----Inline Attachment Follows-----

------------------------------------------------------------------------------


-----Inline Attachment Follows-----

_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users



      
------------------------------------------------------------------------------

_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to