This module allows you to send files through SFTP
The module name is mod-sftp.
The mod-sftp module takes the following configuration:
{
"address": <address>
}
Where
- address The main address for the module. Every module has a main address. Defaults to
sftp
The module supports the following operation
Send a file or directory do a distant server through sftp
To send a file, send a JSON message to the module main address:
{
"action" : "send",
"known-hosts" : <known-hosts>,
"hostname" : <hostname>,
"port" : <port>,
"username" : <username>,
"password" : <password>,
"sshkey" : <sshkey>,
"local-file" : <local-file>,
"dist-file" : <dist-key>
}
Where:
known-hostsis the filename of local known_hosts file. It must contains the informations on the host to connect to. This field is mandatory.hostnameis the destination host. This field is mandatory.portis a number. This field is optionnal, standard port will be used by default.usernameis the name of the SFTP user to use. This field is mandatory.passwordis the password of the SFTP user to use. Password OR SSH Key is mandatory.sshkeyis the filename of the private RSA key to use for connection. If the file can't be loaded and password is filled, password will be used. Password OR SSH Key is mandatory.local-fileis the local filename of the file ou directory to senddist-fileis the distant path and filename where to send the file or directory
An example would be:
{
"action" : "send",
"known-hosts" : "/home/vertx/.ssh/known_hosts",
"hostname" : "sftp.example.com",
"username" : "sftpuser",
"sshkey" : "/home/vertx/.ssh/id_dsa",
"local-file" : "src/test/resources/img.jpg",
"dist-file" : "/vertx/imgsrc.jpg"
}
When the query complete successfully, a reply message is sent back to the sender with the following data:
{
"status": "ok",
}
If an error occurs in saving the document a reply is returned:
{
"status": "error",
"message": <message>
}
Where
messageis an error message.