Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.jcraft.jsch.*;
- public class test {
- public static void main(String args[]) {
- JSch jsch = new JSch();
- Session session = null;
- try {
- session = jsch.getSession("ARCADE", "172.16.10.45", 22);
- session.setConfig("StrictHostKeyChecking", "no");
- session.setPassword("recallboxroot");
- System.out.println("intentando conectar...");
- session.connect();
- System.out.println("conectó");
- Channel channel = session.openChannel("sftp");
- channel.connect();
- ChannelSftp sftpChannel = (ChannelSftp) channel;
- sftpChannel.get("test.txt", "/Documentos/test.txt");
- sftpChannel.exit();
- session.disconnect();
- } catch (JSchException e) {
- e.printStackTrace();
- } catch (SftpException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement