PiVPN Web does not need to run on the same machine as PiVPN. The application connects to the PiVPN host using node-ssh and executesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AZhur771/pivpn-web/llms.txt
Use this file to discover all available pages before exploring further.
pivpn and wg commands over the SSH session. This means you can host the web UI on any Docker-capable machine — a home server, a cloud VM, or your workstation — while the WireGuard installation lives on a separate Raspberry Pi or Linux server.
How the SSH connection works
When PiVPN Web receives a request that requires WireGuard data (for example, listing clients or downloading a config file), it checks whether an SSH connection is already open. If not, it establishes one using the credentials supplied via environment variables. The connection is kept alive and reused for subsequent commands, and it reconnects automatically the next time a command is needed after a disconnection. TheSSH class (lib/SSH.ts) validates that all four required variables are present at startup and throws an error immediately if any are missing, so misconfigured deployments fail fast rather than silently.
Requirements
- SSH is enabled on the PiVPN host (
sudo systemctl enable --now ssh). - The SSH user has permission to run
pivpnandwgcommands (typically viasudo). - The Docker host running PiVPN Web has network connectivity to the PiVPN host on the SSH port (default
22).
Environment variables
| Variable | Default | Description |
|---|---|---|
SSH_HOST | (required) | IP address or hostname of the PiVPN host. |
SSH_PORT | 22 | SSH port on the PiVPN host. |
SSH_USER | (required) | Username used to open the SSH session. |
SSH_PASSWORD | (required) | Password for the SSH user. |
Quick start with docker run
http://<docker-host>:3001 in your browser and log in with the ADMIN_USER and ADMIN_PASSWORD credentials you provided.
Troubleshooting
Cannot connect to SSH host
Cannot connect to SSH host
PiVPN Web logs an error and the dashboard shows no client data.Things to check:
- Verify
SSH_HOSTis the correct IP address or hostname of the PiVPN machine. - Confirm the PiVPN host is reachable from the Docker host:
ping <SSH_HOST>. - Check that a firewall on the PiVPN host is not blocking the SSH port:
sudo ufw statusorsudo iptables -L. - Confirm the SSH service is running on the PiVPN host:
sudo systemctl status ssh.
Permission denied when running WireGuard commands
Permission denied when running WireGuard commands
The SSH session connects successfully but
pivpn or wg commands fail with a permission error.Things to check:- The
SSH_USERaccount must be able to runpivpnandsudo wgwithout a password prompt. Add a sudoers entry if needed: - Verify the user is a member of any required groups on the PiVPN host.
Connection refused on port 22
Connection refused on port 22
The container exits immediately with
Error: connect ECONNREFUSED.Things to check:- Confirm the SSH daemon is listening on port 22:
sudo ss -tlnp | grep :22. - If the PiVPN host uses a non-standard SSH port, set
SSH_PORTto match. For example, if SSH listens on port2222, add-e SSH_PORT=2222to yourdocker runcommand. - Make sure no firewall rule is blocking connections to the SSH port from the Docker host’s IP.