In order to make the rsync4j library a bit more useful all around, I did the following:
- added the
ssh-keygen
binary to the Windows modules - added new Java wrapper classes: one for the
ssh
binary (com.github.fracpete.rsync4j.Ssh
) and one for thessh-keygen
binary (com.github.fracpete.rsync4j.SshKeyGen
)
You can now execute remote commands with the Ssh
wrapper:
import com.github.fracpete.rsync4j.Ssh; import com.github.fracpete.processoutput4j.output.CollectingProcessOutput; ... Ssh ssh = new Ssh() .outputCommandline(true) .verbose(1) .hostname("localhost") .command("ls /tmp"); ConsoleOutputProcessOutput output = new ConsoleOutputProcessOutput(); output.monitor(ssh.builder());
And generate ssh keys using SshKeyGen
:
import com.github.fracpete.rsync4j.SshKeyGen; import com.github.fracpete.processoutput4j.output.CollectingProcessOutput; ... SshKeyGen keygen = new SshKeyGen() .outputCommandline(true) .verbose(1) .keyType("dsa") .newPassPhrase("") .comment("test key") .keyFile("~/testkey"); ConsoleOutputProcessOutput output = new ConsoleOutputProcessOutput(); output.monitor(keygen.builde
The new version is 3.1.2-10, with downloads available from here.