org.springframework.integration.sftp
Class SftpSession
java.lang.Object
org.springframework.integration.sftp.SftpSession
public class SftpSession
- extends Object
c
There are many ways to create a SftpSession just as there are many ways to SSH into a remote system.
You may use a username and password, you may use a username and private key, you may use a username and a private key with a password, etc.
This object represents the connection to the remote server, and to use it you must provide it with all the components you'd normally provide an
incantation of the ssh command.
- Author:
- Josh Long, Mario Gray
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SftpSession
public SftpSession(String userName,
String hostName,
String userPassword,
int port,
String knownHostsFile,
InputStream knownHostsInputStream,
String privateKey,
String pvKeyPassPhrase)
throws Exception
- Parameters:
userName - the name of the account being logged into.hostName - this should be the host. I found values like foo.com work, where
http://foo.com don't.userPassword - if you are not using key based authentication, then you are likely being prompted
for a password each time you login. This is that password. It is not the
passphrase for the private key!port - the default is 22, and if you specify N<0 for this value we'll default it to 22knownHostsFile - this is the known hosts file. If you don't specify it, jsch does some magic to work
without your specification. If you have it in a non well-known location, however,
this property is for you. An example: /home/user/.ssh/known_hostsknownHostsInputStream - this is the known hosts file. If you don't specify it, jsch does some magic to work
without your specification. If you have it in a non well-known location, however,
this property is for you. An example: /home/user/.ssh/known_hosts. Note
that you may specify this or the #knownHostsFile - not both!privateKey - this is usually used when you want passwordless automation (obviously, for this
integration it's useless since this lets you specify a password once, anyway, but
still good to have if required). This file might be ~/.ssh/id_dsa, or a
.pem for your remote server (for example, on EC2)pvKeyPassPhrase - sometimes, to be extra secure, the private key itself is extra encrypted. In order
to surmount that, we need the private key passphrase. Specify that here.
- Throws:
Exception - thrown if any of a myriad of scenarios plays out
getChannel
public com.jcraft.jsch.ChannelSftp getChannel()
getSession
public com.jcraft.jsch.Session getSession()
start
public void start()
throws Exception
- Throws:
Exception
Copyright © 2010. All Rights Reserved.