Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

Ssh Class

Namespace: Rebex.Net
Assembly: Rebex.SshShell.dll (version 7.0.9119)

Provides methods for communication with SSH shell servers.

Syntax
public class Ssh : NetworkSession, ILogWriterProvider, IDisposable, IShellChannelFactory
Inheritance
Object
NetworkSession
Ssh
Implements
ILogWriterProvider
IDisposable
IShellChannelFactory
Inherited Members
NetworkSession.DefaultLogWriter
NetworkSession.GetHashCode()
NetworkSession.InstanceId
NetworkSession.LogWriter
NetworkSession.ServerName
NetworkSession.ServerPort
NetworkSession.UserName
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)

Remarks

All members of this class are thread-safe.

Constructors

Name Description
Ssh()

Initializes a new instance of the Ssh class.

Fields

Name Description
DefaultPort

Default SSH port (22).

Properties

Name Description
DefaultLogWriter

Gets or sets a default log writer used by all new instances of NetworkSession object. Inherited from NetworkSession.

Encoding

Gets or sets the Encoding to use to encode and decode command parameters and server responses.

Fingerprint

Gets the server public key fingerprint (a SHA-256 hash of the server public key).

InstanceId

Gets instance ID (intended for logging purposes). Inherited from NetworkSession.

IsAuthenticated

Gets a value indicating whether the session is authenticated.

IsConnected

Gets a value indicating whether the session is connected.

IsDisposed

Gets a value indicating whether the object is disposed.

LocalEndPoint

Gets the local client EndPoint.

LogWriter

Gets or sets the LogWriter used by this object. Inherited from NetworkSession.

Proxy

Gets or sets the network proxy to use to access a remote server.

RemoteEndPoint

Gets the remote server EndPoint.

ServerKey

Gets the server public key.

ServerName

Gets the server name, if available. Inherited from NetworkSession.

ServerPort

Gets the server port, if available. Inherited from NetworkSession.

Session

Gets the SSH session used by this SSH session.

Settings

Gets or sets SSH object settings.

Timeout

Gets or sets the length of time in milliseconds before the operation times out (specify -1 or 0 to indicate that the request does not time out).

UserName

Gets the authenticated user name, if available. Inherited from NetworkSession.

Version

Gets the version of the SSH component.

Methods

Name Description
Bind(SshSession)

Binds the Ssh object to an underlying SSH session. This can be used instead of Connect(String)/Login(String, String) methods.

CheckConnectionState()

Checks whether the SSH session is still connected. Throws an exception on error.

Connect(String)

Connects to the SSH server.

Connect(String, Int32)

Connects to the SSH server.

ConnectAsync(String, Int32, Object)

Begins asynchronous Connect operation. Connects to the SSH server.

ConnectAsync(String, Object)

Begins asynchronous Connect operation. Connects to the SSH server.

Disconnect()

Informs the server that the connection is about to close and terminates the connection.

DisconnectAsync(Object)

Begins asynchronous Disconnect operation. Informs the server that the connection is about to close and terminates the connection.

Dispose()

Disposes the Ssh object and all the socket objects.

Dispose(Boolean)

Releases the unmanaged resources used by the Ssh object and optionally releases the managed resources.

Finalize()

Finalizer. Called by garbage collector during object destruction.

GetConnectionState()

Checks whether the SSH session is still connected and returns its state.

GetHashCode()

Gets hash code for this object. Inherited from NetworkSession.

Login()

Authenticates the user to the server interactively and initializes the SSH session. Uses AuthenticationRequest event to request credentials.

Login(SshGssApiCredentials)

Authenticates to the server using GSSAPI. Kerberos is only supported on Mono. NTLM is supported on Windows and partially on Mono.

Login(String)

Authenticates the user to the server interactively and initializes the SSH session. Uses AuthenticationRequest event to request credentials.

Login(String, SshAuthenticationAgent)

Authenticates the user to the server using his private key and initializes the SSH session.

Login(String, SshPrivateKey)

Authenticates the user to the server using his private key and initializes the SSH session.

Login(String, String)

Authenticates the user to the server and initializes the SSH session.

Login(String, String, SshAuthenticationAgent)

Authenticates the user to the server using a combination of password and public key and initializes the SSH session.

Login(String, String, SshPrivateKey)

Authenticates the user to the server using a combination of password and public key and initializes the SSH session.

LoginAsync(SshGssApiCredentials, Object)

Begins asynchronous Login operation. Authenticates to the server using GSSAPI. Kerberos is only supported on Mono. NTLM is supported on Windows and partially on Mono.

LoginAsync(Object)

Begins asynchronous Login operation. Authenticates the user to the server interactively and initializes the SSH session. Uses AuthenticationRequest event to request credentials.

LoginAsync(String, SshAuthenticationAgent, Object)

Begins asynchronous Login operation. Authenticates the user to the server using his private key and initializes the SSH session.

LoginAsync(String, SshPrivateKey, Object)

Begins asynchronous Login operation. Authenticates the user to the server using his private key and initializes the SSH session.

LoginAsync(String, Object)

Begins asynchronous Login operation. Authenticates the user to the server interactively and initializes the SSH session. Uses AuthenticationRequest event to request credentials.

LoginAsync(String, String, SshAuthenticationAgent, Object)

Begins asynchronous Login operation. Authenticates the user to the server using a combination of password and public key and initializes the SSH session.

LoginAsync(String, String, SshPrivateKey, Object)

Begins asynchronous Login operation. Authenticates the user to the server using a combination of password and public key and initializes the SSH session.

LoginAsync(String, String, Object)

Begins asynchronous Login operation. Authenticates the user to the server and initializes the SSH session.

RunCommand(String)

Runs a remote command and returns its response. Returns null reference (Nothing in Visual Basic) if the end of response has been reached without any preceding data.

RunCommandAsync(String, Object)

Begins asynchronous RunCommand operation. Runs a remote command and returns its response. Returns null reference (Nothing in Visual Basic) if the end of response has been reached without any preceding data.

SetSocketFactory(ISocketFactory)

Sets the socket factory to be used to create communication sockets.

StartCommand(String)

Starts a remote command.

StartCommandAsync(String, Object)

Begins asynchronous StartCommand operation. Starts a remote command.

StartIncomingTunnel(IPEndPoint, IPEndPoint)

Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnel(IPEndPoint, String, Int32)

Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnel(String, Int32, IPEndPoint)

Starts a new incoming tunnel. Connections to remote address/port will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnel(String, Int32, String, Int32)

Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnelAsync(IPEndPoint, IPEndPoint, Object)

Begins asynchronous StartIncomingTunnel operation. Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnelAsync(IPEndPoint, String, Int32, Object)

Begins asynchronous StartIncomingTunnel operation. Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnelAsync(String, Int32, IPEndPoint, Object)

Begins asynchronous StartIncomingTunnel operation. Starts a new incoming tunnel. Connections to remote address/port will be tunneled from the SSH server through the local machine to the specified target.

StartIncomingTunnelAsync(String, Int32, String, Int32, Object)

Begins asynchronous StartIncomingTunnel operation. Starts a new incoming tunnel. Connections to remote endpoint will be tunneled from the SSH server through the local machine to the specified target.

StartOutgoingTunnel(IPEndPoint, IPEndPoint)

Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote endpoint.

StartOutgoingTunnel(IPEndPoint, String, Int32)

Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote host/port.

StartOutgoingTunnel(String, Int32, String, Int32)

Starts a new outgoing tunnel. Connections to local host/port will be tunneled through the SSH server to the specified remote host/port.

StartOutgoingTunnelAsync(IPEndPoint, IPEndPoint, Object)

Begins asynchronous StartOutgoingTunnel operation. Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote endpoint.

StartOutgoingTunnelAsync(IPEndPoint, String, Int32, Object)

Begins asynchronous StartOutgoingTunnel operation. Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote host/port.

StartOutgoingTunnelAsync(String, Int32, String, Int32, Object)

Begins asynchronous StartOutgoingTunnel operation. Starts a new outgoing tunnel. Connections to local host/port will be tunneled through the SSH server to the specified remote host/port.

StartScripting()

Starts a scripting session with a virtual terminal.

StartScripting(TerminalOptions)

Starts a scripting session with a virtual terminal.

StartScripting(String)

Starts a scripting session with a virtual terminal.

StartScripting(String, TerminalOptions)

Starts a scripting session with a virtual terminal.

StartScripting(String, TerminalOptions, Int32, Int32)

Starts a scripting session with a virtual terminal.

StartScriptingAsync(TerminalOptions, Object)

Begins asynchronous StartScripting operation. Starts a scripting session with a virtual terminal.

StartScriptingAsync(Object)

Begins asynchronous StartScripting operation. Starts a scripting session with a virtual terminal.

StartScriptingAsync(String, TerminalOptions, Int32, Int32, Object)

Begins asynchronous StartScripting operation. Starts a scripting session with a virtual terminal.

StartScriptingAsync(String, TerminalOptions, Object)

Begins asynchronous StartScripting operation. Starts a scripting session with a virtual terminal.

StartScriptingAsync(String, Object)

Begins asynchronous StartScripting operation. Starts a scripting session with a virtual terminal.

StartShell(ShellMode)

Starts a remote shell.

StartShellAsync(ShellMode, Object)

Begins asynchronous StartShell operation. Starts a remote shell.

StartSocksServer(IPEndPoint)

Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote host/port.

StartSocksServer(String, Int32)

Starts a new outgoing tunnel. Connections to local host/port will be tunneled through the SSH server to the specified remote host/port.

StartSocksServerAsync(IPEndPoint, Object)

Begins asynchronous StartSocksServer operation. Starts a new outgoing tunnel. Connections to local endpoint will be tunneled through the SSH server to the specified remote host/port.

StartSocksServerAsync(String, Int32, Object)

Begins asynchronous StartSocksServer operation. Starts a new outgoing tunnel. Connections to local host/port will be tunneled through the SSH server to the specified remote host/port.

StartVirtualTerminal()

Starts a virtual terminal session.

StartVirtualTerminal(TerminalOptions)

Starts a virtual terminal session.

StartVirtualTerminal(TerminalOptions, Int32, Int32)

Starts a virtual terminal session.

StartVirtualTerminalAsync(TerminalOptions, Int32, Int32, Object)

Begins asynchronous StartVirtualTerminal operation. Starts a virtual terminal session.

StartVirtualTerminalAsync(TerminalOptions, Object)

Begins asynchronous StartVirtualTerminal operation. Starts a virtual terminal session.

StartVirtualTerminalAsync(Object)

Begins asynchronous StartVirtualTerminal operation. Starts a virtual terminal session.

ToString()

Returns a string representation of this object.

Events

Name Description
AuthenticationRequest

Occurs when an authentication request is received from the server that cannot be answered programmatically.

BannerReceived

Occurs when a banner message is received from the server.

FingerprintCheck

Occurs when a fingerprint is received from the server and needs to be validated.

TunnelError

Occurs when a tunnel fails with an error.

Explicit Interface Implementations

Name Description
IShellChannelFactory.CreateShellChannel(TerminalOptions, Int32, Int32)

Creates a new shell channel using the specified options.

In This Article
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies