Advertisement
Guest User

Untitled

a guest
May 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import com.jcraft.jsch.*;
  2.  
  3. public class test {
  4. public static void main(String args[]) {
  5. JSch jsch = new JSch();
  6. Session session = null;
  7. try {
  8. session = jsch.getSession("ARCADE", "172.16.10.45", 22);
  9. session.setConfig("StrictHostKeyChecking", "no");
  10. session.setPassword("recallboxroot");
  11. System.out.println("intentando conectar...");
  12. session.connect();
  13. System.out.println("conectó");
  14. Channel channel = session.openChannel("sftp");
  15. channel.connect();
  16. ChannelSftp sftpChannel = (ChannelSftp) channel;
  17. sftpChannel.get("test.txt", "/Documentos/test.txt");
  18. sftpChannel.exit();
  19. session.disconnect();
  20. } catch (JSchException e) {
  21. e.printStackTrace();
  22. } catch (SftpException e) {
  23. e.printStackTrace();
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement