Object | +--helma.Ssh
This class provides methods for connecting to a remote
server via secure shell (ssh) and copying files from/to a remote
server using secure copy (scp). It utilizes "Ganymed SSH-2 for Java"
(see http://www.ganymed.ethz.ch/ssh2/).
Defined in Ssh.js
Author: Robert Gaggl
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| Constructor Summary | |
helma.Ssh(<String> server, <helma.File|java.io.File|String> hosts)
Creates a new instance of helma.Ssh |
|
| Methods Summary | |
Boolean
|
addKnownHosts(<helma.File|java.io.File|String> file)
Opens the file passed as argument and adds the known hosts therein to the list of known hosts for this client. |
Boolean
|
connect(<String> username, <String> password)
Connects to a remote host using plain username/password authentication. |
Boolean
|
connectWithKey(<String> username, <helma.File|java.io.File|String> key, <String> passphrase)
Connects to a remote host using a private key and the corresponding passphrase. |
void
|
disconnect()
Disconnects this client from the remote server. |
String
|
execCommand(<String> cmd)
Executes a single command on the remote server. |
Boolean
|
get(<String|Array> remoteFile, <String> targetDir)
Retrieves a file from the remote server and stores it locally. |
Boolean
|
isConnected()
Returns true if this client is currently connected. |
Object
|
isParanoid()
Returns true if this client is in paranoid mode. |
Boolean
|
put(<String|Array> localFile, <String> remoteDir, <String> mode)
Copies a local file to the remote server |
void
|
setParanoid(<Boolean> p)
Toggles paranoid mode. |
| Constructor Detail |
helma.Ssh(<String> server, <helma.File|java.io.File|String> hosts)
server - The server to connect to
hosts - Either a file containing a list of known hosts, or the path pointing to a file. This argument is optional.
| Method Detail |
Boolean addKnownHosts(<helma.File|java.io.File|String> file)
file - Either a file object or the path to a file containing a list of known hosts
Boolean connect(<String> username, <String> password)
username - The username
password - The password
Boolean connectWithKey(<String> username, <helma.File|java.io.File|String> key, <String> passphrase)
username - The username
key - Either a file object representing the private key file, or the path to it.
passphrase - The passphrase of the private key, if necessary.
void disconnect()
String execCommand(<String> cmd)
cmd - The command to execute on the remote server.
Boolean get(<String|Array> remoteFile, <String> targetDir)
remoteFile - Either the path to a single remote file or an array containing multiple file paths that should be copied onto the local disk.
targetDir - The path to the local destination directory
Boolean isConnected()
Object isParanoid()
Boolean put(<String|Array> localFile, <String> remoteDir, <String> mode)
localFile - Either the path to a single local file or an array containing multiple file paths that should be copied to the remote server.
remoteDir - The path to the remote destination directory
mode - An optional 4-digit permission mode string (eg. 0755);
void setParanoid(<Boolean> p)
p - Either true or false
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |