SSH for NetBird (unofficial)
Unofficial community extension. Not affiliated with or endorsed by NetBird GmbH.
NetBird is a trademark of its respective owner.
VS Code extension that lists your NetBird peers in the sidebar and opens a Remote - SSH
session to a peer in one click. Data comes only from the local CLI (netbird status --json):
no API, no token, no network calls.
Requirements
- NetBird installed, daemon running and connected (
netbird up).
- The Remote - SSH extension (
ms-vscode-remote.remote-ssh). The extension offers to install it if missing.
- SSH access to the peers: either the NetBird SSH server (SSO, see below) or OpenSSH with a key
(
ssh-copy-id user@peer or ~/.ssh/config). OpenSSH (ssh) must be in the PATH.
Installation
From the VS Code Marketplace: search SSH for NetBird in the Extensions view, or
code --install-extension VULGA01.netbird-ssh
From source:
npm install
npm run package # produces netbird-ssh-<version>.vsix
code --install-extension netbird-ssh-0.7.1.vsix --force
Usage
- NetBird icon in the Activity Bar → your machine, then peers grouped under Online and Offline.
Green = active tunnel (P2P), yellow = relayed, blue = online without an active tunnel yet, grey = not answering.
The badge shows the number of online peers.
- Click a peer (or the inline button): new Remote-SSH window to
user@host.
- Right-click a peer: Connect in Current Window, Open SSH Terminal (
ssh in the integrated terminal,
no VS Code Server), Copy IP, Copy FQDN, Set SSH User…, Set Remote Folder….
- Refresh button on every row and in the view title; auto-refresh while the view is visible.
- Gear button in the view title opens the extension settings.
Online/offline with lazy connections. The local daemon reports every peer without an active tunnel as
Idle, even when the dashboard shows it online. The extension therefore checks Idle peers with a TCP
connection to port 22 (any answer = online, timeout = offline) and caches the result
(netbirdSsh.reachabilityCheckSeconds, 5 min by default; the Refresh button re-checks). Side effect: the check
wakes the lazy tunnels. Set it to 0 to keep tunnels idle (Idle peers are then listed as Offline).
First connection to a host. OpenSSH asks to confirm an unknown host key, and Remote-SSH hides that prompt
(the window keeps loading). Before connecting, the extension checks known_hosts; for an unknown host it shows
the key fingerprint in a dialog and records it on Trust and Connect. Hosts served by the NetBird SSH server
are not concerned (NetBird disables host key checking for them).
Settings
| Setting |
Default |
Description |
netbirdSsh.binaryPath |
netbird |
Path to the binary. A bare name is looked up in PATH, then /usr/local/bin, /opt/homebrew/bin. |
netbirdSsh.defaultUser |
"" |
Default SSH user. Empty = ssh host (user from ~/.ssh/config or your local user). |
netbirdSsh.userOverrides |
{} |
User per peer: { "nb-test": "root" } (short name or FQDN). Also set via right-click. |
netbirdSsh.defaultRemotePath |
"" |
Remote folder opened on connect (absolute path). Empty = no folder. |
netbirdSsh.pathOverrides |
{} |
Remote folder per peer: { "nb-test": "/srv/app" }. Also set via right-click. |
netbirdSsh.useIpInsteadOfFqdn |
false |
Use the NetBird IP instead of the FQDN. |
netbirdSsh.refreshIntervalSeconds |
5 |
Auto-refresh (s), 0 = disabled. |
netbirdSsh.showOfflinePeers |
true |
Show peers that are not connected. |
netbirdSsh.reachabilityCheckSeconds |
300 |
Cache of the port-22 check of Idle peers (s). 0 = no check. |
netbirdSsh.sshJwtCacheTtlSeconds |
3600 |
NetBird SSH SSO token cache (s). 0 = disabled, max 86400 (24 h). |
NetBird SSH (SSO)
If the peer runs NetBird's built-in SSH server (rather than OpenSSH), the NetBird client automatically
routes ssh through netbird ssh proxy (via /etc/ssh/ssh_config.d/99-netbird.conf), with an SSO
login in the browser. For Remote-SSH to work:
- SSH Access enabled for the peer in the NetBird dashboard (management overrides the local config).
- On the peer:
netbird up --allow-server-ssh --enable-ssh-local-port-forwarding
(+ --enable-ssh-root to log in as root). Port forwarding is required: Remote-SSH reaches
VS Code Server (listening on the peer's 127.0.0.1) through the SSH tunnel.
- No SSO at all (like Tailscale SSH):
netbird up … --disable-ssh-auth on the peer. Access is then
controlled only by your NetBird policies. Needed for non-interactive clients (e.g. Claude's SSH machines),
which cannot open the browser login.
- SSO cache: Remote-SSH opens several
ssh connections; without a cache, SSO is asked every time.
Set netbirdSsh.sshJwtCacheTtlSeconds and run NetBird SSH: Apply SSH SSO Cache (JWT)
(… menu of the view). It runs netbird down then netbird up --ssh-jwt-cache-ttl N, which drops
NetBird for a few seconds; if admin rights are needed, it opens a terminal with sudo.
| Remote-SSH error |
Cause |
local port forwarding disabled |
--enable-ssh-local-port-forwarding missing on the peer |
Connection refused on port 22 |
NetBird SSH server off (SSH Access off in the dashboard) and no OpenSSH on port 22 |
root login is disabled |
--enable-ssh-root missing, or use another user |
Development
npm run compile # typecheck (strict tsc) + esbuild bundle -> dist/
npm test # parsing unit tests (node:test + fixtures)
npm run watch # continuous rebuild; F5 launches an Extension Host (.vscode/launch.json)
Layout: src/netbirdClient.ts (CLI execution, parsing, types — no vscode dependency),
src/peersTreeProvider.ts, src/commands.ts, src/config.ts, src/jwtCache.ts, src/sshHostKey.ts, src/extension.ts.
Logs are in Output → NetBird SSH.
Releasing
Publishing is automated by .github/workflows/publish.yml on every v* tag: build, tests, package,
publish to the VS Code Marketplace through Trusted Publishing (GitHub OIDC, no stored token),
optionally to Open VSX (secret OVSX_PAT), and a GitHub release with the .vsix.
One-time setup: Marketplace → publisher VULGA01 → Trusted Publishing → add a policy for
repository VULGA01/netbird-ssh-vscode, workflow publish.yml.
Then, for each release (update CHANGELOG.md first):
npm version patch # or minor / major: bumps package.json, commits, tags vX.Y.Z
git push --follow-tags
License
MIT