A streamlined command-line SSH client and SCP utility that connects to your Tailscale network using tsnet. Features powerful multi-host operations, batch command execution, and real tmux integration - all without requiring the full Tailscale daemon.
Perfect for DevOps teams who need fast, reliable SSH access across their Tailscale infrastructure.
- Userspace Tailscale connection using tsnet - no daemon required
- Multiple authentication methods: SSH keys, password prompts, or both
- Interactive SSH sessions with full PTY support and terminal resizing
- Secure host key verification using ~/.ssh/known_hosts
- Direct SCP transfers with automatic upload/download detection
- --list: Fast host discovery with online/offline status
- --multi host1,host2,host3: Real tmux sessions with multiple SSH connections
- --exec "command" host1,host2: Batch command execution across hosts
- --parallel: Concurrent command execution for faster operations
- --copy file host1,host2:/path/: Multi-host file distribution
- --pick: Simple interactive host selection
- ProxyCommand support (-W) for integration with standard tools
- Cross-platform: Linux, macOS (Intel/ARM), Windows
- Multi-language support: English and Spanish localization
- Fast startup - no UI frameworks or complex initialization
- Composable commands - works perfectly in scripts and automation
- Clear error handling and helpful feedback
- Go: Version 1.18 or later installed (go version).
- Tailscale Account: An active Tailscale account.
- Target Node: A machine within your Tailscale network running an SSH server that allows connections from your user/key/password.
You can install ts-ssh using go install (recommended) or build it manually from the source.
Using go install:
(Make sure your $GOPATH/bin or $HOME/go/bin is in your system's PATH)
Manual Build:
- Clone the repository:
git clone https://github.com/derekg/ts-ssh.git cd ts-ssh
- Build the executable: You can now run ./ts-ssh.
Cross-Compilation:
You can easily cross-compile for other platforms. Set the GOOS and GOARCH environment variables. Use CGO_ENABLED=0 for easier cross-compilation.
- For macOS (Apple Silicon):
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ts-ssh-darwin-arm64 .
- For macOS (Intel):
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ts-ssh-darwin-amd64 .
- For Linux (amd64):
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ts-ssh-linux-amd64 .
- For Windows (amd64):
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ts-ssh-windows-amd64.exe .
Arguments:
- For SSH: [user@]hostname[:port] [command...]
- hostname must be the Tailscale MagicDNS name or Tailscale IP address of the target machine.
- user defaults to your current OS username if not provided or specified with -l.
- port defaults to 22 if not provided.
- command... (optional): If provided, executes the command on the remote host instead of starting an interactive shell.
- For SCP (direct CLI):
- Upload: local_path [user@]hostname:remote_path
- Download: [user@]hostname:remote_path local_path
- The user@ in the remote argument is optional; if not provided, the user from -l or the default OS user will be used.
Language Detection Priority:
- CLI flag (--lang)
- TS_SSH_LANG environment variable
- LC_ALL environment variable
- LANG environment variable
- Default (English)
Supported Languages:
- 🇺🇸 English (en) - Default
- 🇪🇸 Spanish (es) - Complete translation
The --multi flag creates real tmux sessions with SSH connections to multiple hosts. This provides a professional terminal multiplexing experience:
Once connected, use standard tmux key bindings:
- Ctrl+B n - Next window (next host)
- Ctrl+B p - Previous window (previous host)
- Ctrl+B 1-9 - Switch to window number
- Ctrl+B c - Create new window
- Ctrl+B d - Detach from session
- Ctrl+B ? - Show all key bindings
Note: The Tailscale authentication flow may show verbose logs during startup. Use -v for clearer diagnostic output if needed.
The first time you run ts-ssh on a machine, or if its Tailscale authentication expires, it will need to authenticate to your Tailscale network.
The program will print a URL to the console. Copy this URL and open it in a web browser. Log in to your Tailscale account to authorize this client ("ts-ssh-client" or the hostname set in code).
Once authorized, ts-ssh stores authentication keys in the state directory (~/.config/ts-ssh-client by default, configurable with -tsnet-dir) so you don't need to re-authenticate every time.
- Host Key Verification: This tool performs host key verification against ~/.ssh/known_hosts by default. This is a crucial security feature to prevent Man-in-the-Middle (MITM) attacks.
- -insecure Flag: The -insecure flag disables host key checking entirely. This is dangerous and should only be used in trusted environments or for specific testing purposes where you fully understand the security implications. You are vulnerable to MITM attacks if you use this flag carelessly.
This project is licensed under the MIT License - see the LICENSE file for details.