0
코드를 작성해야합니다. 하나의 tar 파일을 sftp해야합니다. 유닉스 박스에서 다른 자바로. "SSHFACTORY"내가 모든 명령을 실행하지만, SFTP 명령을 실행할 수 없습니다 메신저 수 있어요을 사용 임 ... 하나는 제안하십시오 수 있습니다"scp"명령이나 java의 유닉스 명령을 사용하는 방법, 즉 하나의 유닉스 박스에서 다른 유닉스 박스로 파일을 sfp하는 방법.
String hostname,username,password;
System.out.println("Enter the machine to which you want to connect ");
hostname = br.readLine();
System.out.println("Enter username : ");
username = br.readLine();
System.out.println("Enter password : ");
password = br.readLine();
SshParameters sshParams = new SshParameters(hostname,username, password);
SshSession session = new SshSession(sshParams);
session.setShellPrompt("$");
session.connect(10000);
System.out.println("Login to websphe");
session.send("sudo su - websphe");
String contents = session.send("ls -ltr ");
session.send("directory u want the file to copy");
session.send("scp [email protected]:"file u want to transfer" create.tar");
이 시점 그것을이 수도 실행할 // 수 없습니다 하나는 :)