Set Up a Terminal

Configure the BptTerminalClient component for in-browser SSH access to your servers.

Home / Getting Started / Terminal Setup

Overview

The BptTerminalClient component provides a fully featured terminal emulator inside your Blazor application. It connects to remote servers via SSH through a server-side proxy, giving your users (or your admin team) direct shell access from the browser — no separate SSH client required.

Security Notice The terminal component provides real shell access to remote machines. Only expose it to authenticated and authorized users. Never deploy the terminal on public-facing pages without proper access controls.

Prerequisites

  • .NET 10 SDK installed on your development machine
  • Blazor Power Tools package installed (Getting Started)
  • A target server with SSH enabled (OpenSSH, port 22 by default)
  • SSH credentials (username/password or SSH key pair)
  • SignalR configured for large messages (BPT sets this up automatically)

Step 1: Configure SignalR for Terminal Traffic

Terminal sessions stream data over SignalR. For smooth operation, ensure your SignalR configuration supports adequate message sizes. In Program.cs:

builder.Services.AddSignalR(options => { options.MaximumReceiveMessageSize = 1024 * 1024; // 1 MB }); // If using Blazor Server builder.Services.AddServerSideBlazor(options => { options.DetailedErrors = builder.Environment.IsDevelopment(); });

Step 2: Add the Terminal Component

Place the BptTerminalClient on a page or in a layout. At minimum, provide a hostname:

<BptTerminalClient Host="192.168.1.10" Port="22" Username="admin" AuthenticationMethod="Password" Height="500px" />

The component renders a terminal emulator with full ANSI color support, scrollback buffer, and keyboard handling.

Step 3: Authentication Methods

BptTerminalClient supports multiple authentication modes:

Password Authentication

<BptTerminalClient Host="server.local" Username="admin" AuthenticationMethod="Password" /> @* The component prompts the user for a password at connection time *@

SSH Key Authentication

<BptTerminalClient Host="server.local" Username="deploy" AuthenticationMethod="PrivateKey" PrivateKeyPath="/home/app/.ssh/id_rsa" />
Tip For production deployments, store SSH keys and credentials in a secure vault (Azure Key Vault, HashiCorp Vault, etc.) and inject them via configuration. Never hard-code credentials in Razor files.

Step 4: Customization

The terminal supports visual and behavioral customization:

<BptTerminalClient Host="server.local" Username="admin" Height="600px" FontSize="14" FontFamily="'Cascadia Code', 'Fira Code', monospace" Theme="dark" ShowConnectionStatus="true" AutoReconnect="true" MaxScrollback="5000" />
Parameter Type Description
HoststringSSH server hostname or IP address
PortintSSH port (default: 22)
UsernamestringSSH username
HeightstringTerminal height (CSS value)
FontSizeintFont size in pixels
Themestring"dark" or "light"
AutoReconnectboolAuto-reconnect on connection drop
MaxScrollbackintNumber of scrollback lines to keep

Security Best Practices

Access Control

Always place the terminal behind authentication. Use the [Authorize] attribute on the page or wrap with <AuthorizeView> to restrict access to specific roles.

Audit Logging

Consider logging terminal session starts and stops. Pair with your SSH server's audit log to maintain a complete record of terminal access for compliance.

Network Isolation

The SSH connection runs server-side. The Blazor server must have network access to the target host. Use firewall rules to limit which hosts the Blazor server can SSH into.

SSH Key Rotation

Rotate SSH keys regularly. Use dedicated service accounts with limited privileges rather than root access. Disable password authentication where possible.


An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.