Fields and methods of the helma.Ssh class.
To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/Ssh.js')
To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/Ssh.js')
Creates a new instance of helma.Ssh
parameters
String | server | The server to connect to |
helma.File, java.io.File, String | hosts | Either a file containing a list of known hosts, or the path pointing to a file. This argument is optional. |
methods
- addKnownHosts(file)
- connect(username, password)
- connectWithKey(username, key, passphrase)
- put(localFile, remoteDir, mode)
- get(remoteFile, targetDir)
- execCommand(cmd)
- setParanoid(p)
Methods
Opens the file passed as argument and adds the known hosts
therein to the list of known hosts for this client.
parameters
helma.File, java.io.File, String | file | Either a file object or the path to a file containing a list of known hosts |
returns
True if adding the list was successful, false otherwise |
Connects to a remote host using plain username/password authentication.
parameters
String | username | The username |
String | password | The password |
returns
True in case the connection attempt was successful, false otherwise. |
Connects to a remote host using a private key and the corresponding
passphrase.
parameters
String | username | The username |
helma.File, java.io.File, String | key | Either a file object representing the private key file, or the path to it. |
String | passphrase | The passphrase of the private key, if necessary. |
returns
True in case the connection attempt was successful, false otherwise. |
Disconnects this client from the remote server.
Returns true if this client is currently connected.
returns
True in case this client is connected, false otherwise. |
Copies a local file to the remote server
parameters
String, Array | localFile | Either the path to a single local file or an array containing multiple file paths that should be copied to the remote server. |
String | remoteDir | The path to the remote destination directory |
String | mode |
An optional 4-digit permission mode string (eg.
0755 );
|
returns
True in case the operation was successful, false otherwise. |
Retrieves a file from the remote server and stores it locally.
parameters
String, Array | remoteFile | Either the path to a single remote file or an array containing multiple file paths that should be copied onto the local disk. |
String | targetDir | The path to the local destination directory |
returns
True if the copy process was successful, false otherwise. |
Executes a single command on the remote server.
parameters
String | cmd | The command to execute on the remote server. |
returns
The result of the command execution |
Toggles paranoid mode. If set to true this client tries to
verify the host key against the its list of known hosts
during connection and rejects if the host key is not found
therein or is different.
parameters
Boolean | p | Either true or false |
Returns true if this client is in paranoid mode.
returns
Boolean |
see