# Open a local SSH tunnel

Open a local SSH tunnel on Evotec with practical examples, usage guidance, and reusable project workflows.

Project

Transferetto

Small PowerShell module with FTPS/SFTP functionality

[View on GitHub](https://github.com/EvotecIT/Transferetto) [Visit Website](#) [Releases](https://github.com/EvotecIT/Transferetto/releases/tag/Transferetto-v2.0.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/Transferetto)

Stars**93**

Forks**18**

Open issues**0**

PowerShell Gallery downloads**14067470**

Release**v2.0.4**

Language: C# Updated: 2026-11-17

Curated Examples

Use Transferetto to forward a remote service to a local port through SSH.

This pattern is useful when a remote database or private service should be reachable locally for the duration of an SSH session.

It is adapted from the source example at `Examples/Example17-SSHLocalTunnel.ps1`.

## When to use this pattern

- A remote service is bound to localhost on the server.
- You want to expose it locally without changing the service itself.
- The tunnel should exist only while your script keeps the SSH session open.

## Example

```powershell
Import-Module Transferetto

$sshClient = Connect-SSH -Server 'server.example.com' -Credential (Get-Credential)

$tunnel = Start-SSHLocalTunnel -SshClient $sshClient `
    -BoundHost '127.0.0.1' `
    -BoundPort 15432 `
    -RemoteHost '127.0.0.1' `
    -RemotePort 5432

$tunnel | Format-List

# Use 127.0.0.1:15432 locally while the tunnel remains open.
Read-Host 'Press Enter to stop the tunnel'

Stop-SSHTunnel -TunnelSession $tunnel
Disconnect-SSH -SshClient $sshClient
```

## What this demonstrates

- creating a local forwarded port for a remote service
- keeping the tunnel lifecycle explicit in the script
- closing the tunnel before disconnecting the SSH session

## Source

- [Example17-SSHLocalTunnel.ps1](https://github.com/EvotecIT/Transferetto/blob/master/Examples/Example17-SSHLocalTunnel.ps1)

<!-- PowerForge markdown artifact sha256:2DC09950F6C8C8B89076D6796F1FE357AEAAEE5719BC6FE0B149C31ADDE55ED8 -->
