Set Up a Terminal
Configure the BptTerminalClient component for in-browser SSH access to your servers.
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.
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" />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 |
|---|---|---|
Host | string | SSH server hostname or IP address |
Port | int | SSH port (default: 22) |
Username | string | SSH username |
Height | string | Terminal height (CSS value) |
FontSize | int | Font size in pixels |
Theme | string | "dark" or "light" |
AutoReconnect | bool | Auto-reconnect on connection drop |
MaxScrollback | int | Number 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.