I'm looking for java code to copy files to a remote linux system. I have tried Runtime.getRuntime().exec()
function by passing an scp
command, but each time I run the program it is asking for the remote system password. I'd like to avoid that.
I looked at the Jsch
library — using this I can login to a remote system — but I can't copy the files to the remote system. Once I login I can do scp
to my host but again it requires the host system username and password. However, I only have the remote system's information.
Best Answer
Copying a file from one host to another requires a daemon on the remote host, implementing some application-level file transmission protocol. This is a requirement no matter from which language you are going to talk to that remote daemon.
Your options for Linux systems are:
All of this seems like a lot of work, and in deed it is, because there is not a single widely-adopted and standardized protocol that would be implemented and configured out-of-the-box on most systems.