Skip to content
Nuno Aguiar edited this page Apr 24, 2018 · 3 revisions

SSH.SSH

SSH.SSH(aHost, aPort, aLogin, aPass, anIdentificationKey, withCompression, aTimeout) : SSH

Creates an instance of a SSH client (and connects) given a host, port, login username, password and,  optionally a identity file path and the indication of use of compression. Alternatively you can provide  just a simple url where aHost = ssh://user:pass@host:port/identificationKey?timeout=1234&compression=true.


SSH.cd

SSH.cd(aPath)

Changes the remote directory to the corresponding path.


SSH.close

SSH.close()

Closes the SSH connection.


SSH.df

SSH.df(aPath) : Map

Tries to return an object, for the remote provided path, with size, used space, available space,  availableForRoot space and capacityPercentage.


SSH.exec

SSH.exec(aCommand, aStdIn, shouldOutputAlso, pty) : String

Executes a command over the SSH connection. You can optionally provide the input and indicate that it shouldOutputAlso  (boolean) to stdout and if you want to allocate a pty (boolean). The stderr will be stored in __stderr and also output  if shouldOutputAlso = true.


SSH.execSudo

SSH.execSudo(aCommandWithSudo, aUser, aStdIn, shouldOutputAlso, pty) : String

Executes a command over the SSH connection using sudo to aUser. You can optionally provide the input and indicate that it shouldOutputAlso (boolean) to stdout and if you want to allocate a pty (boolean). The stderr will be stored in  __stderr and also output if shouldOutputAlso = true.


SSH.get

SSH.get(aRemoteFilePath, aLocalFilePath) : String

Retrieves a file, using the SFTP connection, from aRemoteFilePath to aLocalFilePath. Use SSH.getBytes in case you are reading a binary file.


SSH.getBytes

SSH.getBytes(aRemoteFile) : anArrayOfBytes

Returns an array of bytes with the contents of aRemoteFilePath, using the SFTP connection.


SSH.getExecChannel

SSH.getExecChannel() : Object

Obatins the internal SSH session exec channel.


SSH.getFile

SSH.getFile(aRemoteFile, aLocalFile) : anArrayOfBytes

Retrieves a remote file over the SSH connection to be stored on the local path provided. If aLocalFile is not provided the remote file contents will be returned as an array of bytes.


SSH.getSftpChannel

SSH.getSftpChannel() : Object

Obtains the internal SSH session sftp channel.


SSH.listFiles

SSH.listFiles(aPath) : Map

Returns a files array where each entry has filename, longname, filepath, size, permissions, lastModified,  createTime, isDirectory and isFile.


SSH.mkdir

SSH.mkdir(aPath)

Tries to create a remote directory for the provided aPath.


SSH.put

SSH.put(aSourceFilePath, aRemoteFilePath)

Copies a aSourceFilePath to aRemoteFilePath, using the SFTP connection.


SSH.putBytes

SSH.putBytes(aRemoteFilePath, bytes)

Writes an array of bytes on aRemoteFilePath, using the SFTP connection.


SSH.pwd

SSH.pwd() : String

Returns the current remote path.


SSH.rename

SSH.rename(aOriginalName, aNewName)

Renames a remote original filename to a newname.


SSH.rm

SSH.rm(aFilePath)

Removes a remote filename at the provided aFilePath.


SSH.rmdir

SSH.rmdir(aPath)

Removes a remote directory at the provided aPath.


SSH.sendFile

SSH.sendFile(aSourceFile, aRemoteFile)

Sends a source file over the SSH connection to be stored on the remote path provided.


SSH.setTimeout

SSH.setTimeout(aTimeout)

Sets aTimeout in ms for the SSH connection.


SSH.sftpGet

SSH.sftpGet(aRemoteFile, aLocalFile) : JavaStream

Retrieves a remote file over the SFTP connection to be stored on the local path provided. If aLocalFile is not provided the remote file contents will be returned as a Java Stream


SSH.sftpPut

SSH.sftpPut(aSource, aRemoteFile)

Sends aSource file (if string) or a Java stream to a remote file path over a SFTP connection.


SSH.tunnelLocal

SSH.tunnelLocal(aLocalPort, aRemoteHost, aRemotePort)

Creates a TCP tunnel between a local port and a remote host and port over the SSH connection.


SSH.tunnelLocalBind

SSH.tunnelLocalBind(aLocalInterface, aLocalPort, aRemoteHost, aRemotePort)

Creates a TCP tunnel, on the aLocalInterface only, between a local port and a remote host and port over the SSH connection.


SSH.tunnelRemote

SSH.tunnelRemote(aRemotePort, aLocalAddress, aLocalPort)

Creates a TCP tunnel between a local host and port to be accessed from a remote port over the SSH connection.


SSH.tunnelRemoteBind

SSH.tunnelRemoteBind(aRemoteInterface, aRemotePort, aLocalAddress, aLocalPort)

Creates a TCP tunnel, on the aRemoteInterface only, between a local host and port to be accessed from a remote  port over the SSH connection.

Clone this wiki locally