Table of Contents

Method ForwardRemoteUnixSocketAsync

Namespace
SshSharp
Assembly
SshSharp.dll

ForwardRemoteUnixSocketAsync(string, string, int, CancellationToken)

Remote Unix-socket forwarding (ssh -R /remote/socket:host:port, streamlocal-forward@openssh.com): asks the server to listen on the Unix socket remoteSocketPath and relays every connection made to it to localHost:localPort, as reached from this machine. For example, a database here becomes a socket that programs on the server can open. sshd's StreamLocalBindUnlink decides whether a stale socket file is replaced.

public Task<SshRemoteSocketForwarder> ForwardRemoteUnixSocketAsync(string remoteSocketPath, string localHost, int localPort, CancellationToken cancellationToken = default)

Parameters

remoteSocketPath string
localHost string
localPort int
cancellationToken CancellationToken

Returns

Task<SshRemoteSocketForwarder>

Exceptions

SshException

The server refused (sshd's AllowStreamLocalForwarding, or the socket exists).

ForwardRemoteUnixSocketAsync(string, string, CancellationToken)

Remote Unix-socket forwarding to a Unix socket here (ssh -R /remote/socket:/local/socket): for example, a local gpg-agent or Docker socket that programs on the server can use.

public Task<SshRemoteSocketForwarder> ForwardRemoteUnixSocketAsync(string remoteSocketPath, string localSocketPath, CancellationToken cancellationToken = default)

Parameters

remoteSocketPath string
localSocketPath string
cancellationToken CancellationToken

Returns

Task<SshRemoteSocketForwarder>

Exceptions

SshException

The server refused (sshd's AllowStreamLocalForwarding, or the socket exists).