SSH2::Session
Inherits Reference / Object
Constants
Callbacks passed to c-code must not capture context
Constructors
Class methods
Instance methods
Indicates whether or not the named session has been successfully authenticated.
Once the session has been setup and handshake has completed successfully,
this function can be used to get the server id from the banner each server
presents.
Set the banner that will be sent to the remote host when the SSH session is
started with handshake. This is optional; a banner corresponding to the
protocol and libssh2 version will be sent by default.
Tunnel TCP/IP connect through the SSH session to direct UNIX socket.
Yields the tunnel channel and closes it when the block returns.
Tunnel a TCP/IP connection through the SSH transport via the remote host to a third party. Communication from the client to the SSH server remains encrypted, communication from the server to the 3rd party host travels in cleartext.
Yields the tunnel channel and closes it when the block returns.
Send a disconnect message to the remote host associated with session, along with a description.
When set before handshake, libssh2 will try to negotiate compression for
the connection (off by default). Must be set prior to handshake.
When set, libssh2 lets SIGPIPE fire from the underlying socket instead of blocking it.
Instruct the remote SSH server to begin listening for inbound TCP/IP
connections. New connections will be queued by the library until accepted
by Listener.accept.
Returns the current session's host key
Returns a tuple consisting of the computed digest of the remote system's hostkey and its type.
Login with an interactive password
Configure how often keepalive messages should be sent. interval is in
seconds (0, the default, disables keepalive); want_reply asks the remote
to acknowledge each keepalive. Must be called after handshake.
Login with username using SSH agent Warning: this method will block the crystal lang event loop. Not recommended outside of very small, limited purpose applications.
Login with username using pub/priv key values
Send a SSH_USERAUTH_NONE request to the remote host. Unless the remote host
is configured to accept none as a viable authentication scheme (unlikely),
it will return SSH_USERAUTH_FAILURE along with a listing of what
authentication schemes it does support. In the unlikely event that none
authentication succeeds, this method with return nil. This case may be
distinguished from a failing case by examining authenticated?.
Returns false value if authentication was successfull, an array of supported methods string or true otherwise
Login with username using pub/priv key files
Returns the actual method negotiated for a particular transport parameter.
Like perform_nonblock, but for libssh2 calls that return a handle/pointer
(EAGAIN is detected via session_last_errno when the handle is null).
Allocate a new channel for exchanging data with the server.
Runs the block, retrying on EAGAIN (waiting on the socket in between) until
libssh2 returns a real result; raises on error. Wraps calls that return an
integer status. Used internally by every blocking libssh2 operation.
Request a file from the remote host via SCP. A new channel is passed to the block and closed afterwards.
Download a file from the remote host via SCP to the local filesystem.
Send a file to the remote host via SCP. A new channel is passed to the block and closed afterwards.
Send a file from a local filesystem to the remote host via SCP.
Send a keepalive message if needed. Return value indicates how many seconds you can sleep after this call before you need to call it again.
Set preferred methods to be negotiated. These preferences must be set prior
to calling handshake, as they are used during the protocol initiation
phase.
Get a list of supported algorithms for the given method_type.
Returns the timeout (in milliseconds) for how long a blocking the libssh2 function calls may wait until they consider the situation an error and raise an exception
Set the timeout in milliseconds for how long a blocking the libssh2 function calls may wait until they consider the situation an error and raise an exception.
Set the trace option. Only available if libssh2 is compliled with debug mode.
Verifies the session's host key against an OpenSSH known_hosts file, returning the raw verdict. Encapsulates the host-key-type -> typemask mapping so callers do not have to. A missing file yields NOTFOUND; an unknown key type yields FAILURE.