-
Notifications
You must be signed in to change notification settings - Fork 6
ssh
- SSH.SSH
- SSH.cd
- SSH.close
- SSH.df
- SSH.exec
- SSH.execSudo
- SSH.get
- SSH.getBytes
- SSH.getExecChannel
- SSH.getFile
- SSH.getSftpChannel
- SSH.listFiles
- SSH.mkdir
- SSH.put
- SSH.putBytes
- SSH.pwd
- SSH.rename
- SSH.rm
- SSH.rmdir
- SSH.sendFile
- SSH.setTimeout
- SSH.sftpGet
- SSH.sftpPut
- SSH.tunnelLocal
- SSH.tunnelLocalBind
- SSH.tunnelRemote
- SSH.tunnelRemoteBind
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(aPath)
Changes the remote directory to the corresponding path.
SSH.close()
Closes the SSH connection.
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(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(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(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(aRemoteFile) : anArrayOfBytes
Returns an array of bytes with the contents of aRemoteFilePath, using the SFTP connection.
SSH.getExecChannel() : Object
Obatins the internal SSH session exec channel.
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() : Object
Obtains the internal SSH session sftp channel.
SSH.listFiles(aPath) : Map
Returns a files array where each entry has filename, longname, filepath, size, permissions, lastModified, createTime, isDirectory and isFile.
SSH.mkdir(aPath)
Tries to create a remote directory for the provided aPath.
SSH.put(aSourceFilePath, aRemoteFilePath)
Copies a aSourceFilePath to aRemoteFilePath, using the SFTP connection.
SSH.putBytes(aRemoteFilePath, bytes)
Writes an array of bytes on aRemoteFilePath, using the SFTP connection.
SSH.pwd() : String
Returns the current remote path.
SSH.rename(aOriginalName, aNewName)
Renames a remote original filename to a newname.
SSH.rm(aFilePath)
Removes a remote filename at the provided aFilePath.
SSH.rmdir(aPath)
Removes a remote directory at the provided aPath.
SSH.sendFile(aSourceFile, aRemoteFile)
Sends a source file over the SSH connection to be stored on the remote path provided.
SSH.setTimeout(aTimeout)
Sets aTimeout in ms for the SSH connection.
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(aSource, aRemoteFile)
Sends aSource file (if string) or a Java stream to a remote file path over a SFTP connection.
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(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(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(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.