Repository navigation
Install in LXC Incus Proxmox
Docker stays the recommended way to run WebSSH (Docker and Docker Compose). Where Docker is not an option, for example in an unprivileged LXC, Incus or Proxmox container, WebSSH runs as a native systemd service: it is a single static Go program without runtime dependencies. On Unraid use the template instead (Install on Unraid).
| Way | When | What you maintain |
|---|---|---|
| A: native service | the container runs systemd, Docker is not wanted or not possible | the binary, the unit file and the environment file |
| B: Docker in the container | Docker is acceptable inside the container | the Compose files, as on any Docker host |
Both ways keep all data in one directory and run exactly one WebSSH process per data directory.
Release archives exist from 3.5.0 on, for Linux on amd64 and arm64:
webssh-<version>-linux-<arch>.tar.gz with the binary, the license files and
the systemd files of deploy/systemd, and SHA256SUMS. The archives are
reproducible from the tagged source with
scripts/build-release-binaries.sh <version>.
The service file systemd/webssh.service runs WebSSH as the system
account webssh in a systemd sandbox: no capabilities, a read-only system,
no access to home directories, its own /tmp, no devices, a system call
filter and write access only to /var/lib/webssh (DATA_DIR) and
/var/lib/webssh-recovery (BACKUP_TEMP_DIR). Every release is installed
exactly as below in a container with systemd and checked for sign-in, SSH,
SFTP, restart and stop under this sandbox.
The sandbox uses mount and user namespaces and its own /proc. In an
unprivileged container that needs nesting, and the native service requires
it:
| Platform | Setting |
|---|---|
| Proxmox VE |
pct set <id> --features nesting=1, or --features nesting=1 with pct create. The web interface sets it for new unprivileged containers; pct create does not and only warns You may need to enable nesting. |
| Incus | incus config set <name> security.nesting=true |
| LXC |
lxc.include = /usr/share/lxc/config/nesting.conf in the container's configuration |
Restart the container after the change. Without nesting the service does
not start, the container's AppArmor profile denies the /proc mount and
user namespaces, and journalctl -u webssh shows a restart loop with
status=226/NAMESPACE (Failed to set up mount namespacing) on Debian 12
or status=217/USER (Failed to set up user namespacing) on
Ubuntu 24.04.
Container images of the images: remote (Incus and LXC, built with
distrobuilder) switch five sandbox options off for every service: a
generator writes /run/systemd/system/service.d/zzz-lxc-service.conf with
NoNewPrivileges=no, ProtectProc=default, ProcSubset=all,
ProtectKernelTunables=no and ProtectControlGroups=no.
systemctl cat webssh shows it after the unit. Four options of the unit
then no longer apply: the service sees all processes of the container,
/proc/sys and the cgroup tree are no longer read-only for it, and
systemd-analyze security webssh rates it about 1.8 instead of 1.1. The
other options of the sandbox (no capabilities, a read-only system, no home
directories, the system call filter) still apply.
In these containers install the drop-in
systemd/webssh.service.d/zzzz-webssh-sandbox.conf from the archive. It
restores the four options of the unit; its name sorts after the image's
drop-in. ProcSubset stays at its default in the unit, because automation
reads the boot id below /proc/sys to recognise the host WebSSH runs on:
install -d -m 0755 /etc/systemd/system/webssh.service.d
install -m 0644 "/root/webssh-$VERSION-linux-$ARCH/systemd/webssh.service.d/zzzz-webssh-sandbox.conf" \
/etc/systemd/system/webssh.service.d/
systemctl daemon-reload && systemctl restart websshThe templates of Proxmox VE (pveam) do not carry this generator. There
the unit applies in full and rates 1.1 without the drop-in; it is not
needed, and installing it changes nothing.
Tested with unprivileged containers on Proxmox VE 9.3 (templates
debian-12-standard and ubuntu-24.04-standard) and Incus 7.7
(images:debian/12 and images:ubuntu/24.04), on amd64; arm64 was
tested in an emulated Ubuntu 24.04 system.
A container that runs a 3.0 to 3.3 source installation under Gunicorn keeps its data: read Moving a 3.x source installation to the native binary first, because the steps below replace an environment file and a unit named like the old ones.
Run as root in the container. A shell from pct enter or pct exec on
Proxmox VE has no /usr/local/bin in PATH, so the commands call the
binary by its full path. The archive is unpacked in /root, because /tmp
is empty after a restart of the container. Set the version and the
architecture (amd64 or arm64, dpkg --print-architecture shows it):
VERSION=3.5.2
ARCH=amd64
cd /root
curl -fLO "https://github.com/bifrost0x/webssh/releases/download/v$VERSION/webssh-$VERSION-linux-$ARCH.tar.gz"
curl -fLO "https://github.com/bifrost0x/webssh/releases/download/v$VERSION/SHA256SUMS"
sha256sum --check --ignore-missing SHA256SUMSsha256sum must print OK for the archive. The archives carry a GitHub
build provenance attestation; with the GitHub CLI, on any machine, check
that the archive was built from the tag by the release workflow of this
repository:
gh attestation verify "webssh-$VERSION-linux-$ARCH.tar.gz" -R bifrost0x/webssh \
--signer-workflow bifrost0x/webssh/.github/workflows/docker-publish.yml \
--source-ref "refs/tags/v$VERSION"Install the binary, the account, the settings and the service. The unit and the example settings come from the checked archive, so the checksum and the attestation cover the sandbox as well:
tar -xzf "webssh-$VERSION-linux-$ARCH.tar.gz"
cd "webssh-$VERSION-linux-$ARCH"
install -m 0755 webssh /usr/local/bin/webssh
/usr/local/bin/webssh version
useradd --system --user-group --home-dir /var/lib/webssh --no-create-home \
--shell /usr/sbin/nologin webssh
install -d -m 0755 /etc/webssh
install -m 0600 systemd/webssh.env.example /etc/webssh/webssh.env
install -m 0644 systemd/webssh.service /etc/systemd/system/webssh.service
cd ..In a container of the images: remote, add the sandbox drop-in as
described under Container settings.
Edit /etc/webssh/webssh.env: at least CORS_ORIGINS and ALLOWED_HOSTS
with your public HTTPS address, and SSH_ALLOWED_INTERNAL_NETWORKS with the
private networks of the hosts WebSSH may reach. The file uses the production
profile and listens on 127.0.0.1:5000 for a reverse proxy in the same
container; every setting is described in the
Configuration Reference. Leave SECRET_KEY
unset: the first start creates /var/lib/webssh/secret_key with mode 0600
for the webssh account.
systemctl daemon-reload
systemctl enable --now webssh
/usr/local/bin/webssh healthcheck && echo ready
journalctl -u webssh -n 20The server does not report readiness to systemd, so systemctl start
returns once the process runs; /usr/local/bin/webssh healthcheck (or
curl -fsS http://127.0.0.1:5000/ready) answers whether it serves. A
monitoring system can use either.
Commands such as create-admin must run as the webssh account with the
same settings as the service. systemd-run does both:
systemd-run --pty --wait --collect --quiet -p User=webssh -p Group=webssh \
-p UMask=0077 -p EnvironmentFile=/etc/webssh/webssh.env \
/usr/local/bin/webssh create-admin --username adminUse the same prefix for reset-password, backup and the other commands of
webssh help
(commands).
Commands marked "stopped" there need systemctl stop webssh first. Never
run them as root: files that root creates in /var/lib/webssh belong to
root, and the service cannot use them.
Terminate HTTPS in a reverse proxy and forward to 127.0.0.1:5000, with the
WebSocket upgrade, as in
Reverse Proxy and Subfolder Deployment.
The proxy must accept request bodies up to MAX_UPLOAD_SIZE (5 GiB by
default, set in /etc/webssh/webssh.env): nginx refuses anything above
1 MiB with 413 unless the location sets client_max_body_size 5g;. Add
proxy_request_buffering off; as well, so uploads stream to WebSSH instead
of being stored by nginx first.
The environment file trusts one proxy at 127.0.0.1
(TRUSTED_PROXIES=1, TRUSTED_PROXY_CIDRS=127.0.0.1/32). If the proxy runs
elsewhere, set HOST to the container's address, TRUSTED_PROXY_CIDRS to
the proxy's address and allow only the proxy to connect, for example with
the firewall of Proxmox or Incus.
Read the release notes first, then take a backup (below). Keep the running binary for the way back:
VERSION=3.5.3 # the new version
cd /root
# download and check the archive as under Install
tar -xzf "webssh-$VERSION-linux-$ARCH.tar.gz"
cp /usr/local/bin/webssh /usr/local/bin/webssh.previous
systemctl stop webssh
install -m 0755 "webssh-$VERSION-linux-$ARCH/webssh" /usr/local/bin/webssh
systemctl start webssh
/usr/local/bin/webssh healthcheck && /usr/local/bin/webssh versionWhen the release notes mention a changed unit or environment file, compare
yours with the files in /root/webssh-$VERSION-linux-$ARCH/systemd before the
start; local changes belong in a drop-in (below), which an update leaves
alone.
The release notes say whether the previous version starts on the data of the new one. If it does:
systemctl stop webssh
install -m 0755 /usr/local/bin/webssh.previous /usr/local/bin/webssh
systemctl start websshOtherwise restore the backup taken before the update with the previous
binary. Versions before 3.5.0 have no release archives; build one from its
tag with scripts/build-release-binaries.sh <version>
(Installation from Source), or take the static
binary from the image of that version on any machine with Docker:
docker create --name webssh-old ghcr.io/bifrost0x/webssh:3.4.5
docker cp webssh-old:/app/webssh ./webssh-3.4.5
docker rm webssh-old3.4.5 starts on the data of 3.5.0, 3.5.0 on the data of 3.5.1, and 3.5.1 on the data of 3.5.2.
/var/lib/webssh holds the database, the keys and the generated
secret_key; /var/lib/webssh-recovery holds backup archives.
A complete backup, with saved passwords and SSH keys, is a copy of the
whole container (Proxmox vzdump, an Incus snapshot) or of both
directories, taken while the service is stopped:
systemctl stop webssh
tar --numeric-owner -czf /root/webssh-data.tar.gz /var/lib/webssh /var/lib/webssh-recovery
systemctl start websshRestore it with the service stopped, keeping the owner webssh
(tar --numeric-owner -xzf … -C /, or chown -R webssh:webssh on both
directories afterwards).
The program also creates an export:
systemctl stop webssh
systemd-run --pipe --wait --collect --quiet -p User=webssh -p Group=webssh \
-p UMask=0077 -p EnvironmentFile=/etc/webssh/webssh.env \
/usr/local/bin/webssh backup create --confirm-offline
systemctl start websshIt prints the path of the archive below /var/lib/webssh-recovery. The
export leaves out saved passwords and SSH keys: after backup restore the
accounts, hosts and settings are back, but connections and automation that
used a saved credential answer credential_missing until it is saved
again. Copy archives off the container and store them encrypted: they
contain the secret_key unless --without-secret-key is given. See
Backup, Restore and Secret Rotation.
Change the unit with a drop-in, systemctl edit webssh, never in the file
itself. What WebSSH needs is allowed; these cases need an addition:
| Case | Drop-in |
|---|---|
DATA_DIR on another mounted file system, e.g. /srv/webssh
|
ReadWritePaths=/srv/webssh and Environment=DATA_DIR=/srv/webssh, also in webssh.env; the directory belongs to webssh with mode 0700
|
| A port below 1024 without a proxy |
AmbientCapabilities=CAP_NET_BIND_SERVICE and CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
| A memory limit for the service |
MemoryMax=1G; WebSSH sets its Go memory limit below it |
| LDAP secrets | none: create /etc/webssh/ldap with owner webssh and mode 0700, run webssh ldap-secret --secret-dir /etc/webssh/ldap … with the systemd-run prefix, and set LDAP_BIND_PASSWORD_FILE=/etc/webssh/ldap/ldap_bind_password and LDAP_CA_FILE=/etc/webssh/ldap/ldap_ca.pem in webssh.env
|
| An own CA bundle | none, as long as it is outside /home and /root: SSL_CERT_FILE=/path/bundle.pem in webssh.env
|
| Directories shared as local sources |
ReadOnlyPaths= for read-only and ReadWritePaths= for read-write sources; pass host directories into an Incus container with shift=true
|
Tailscale SSH needs no change: the route checks of the
tailnet rule use netlink sockets, which the unit allows.
systemd-analyze security webssh rates the supplied unit at 1.5 or lower,
and the release checks confirm that the options take effect in the process. In a
container of the images: remote it rates about 1.8 until the sandbox
drop-in is installed (see Container settings).
Nesting stays required; there is no drop-in that loosens the sandbox for
containers without it.
The unit's sandbox is the tested and supported confinement. A mandatory access control profile can restrict WebSSH further; WebSSH ships no profile file, because one that is not tested with every release goes stale without anyone noticing. The checklist and the example below were checked with WebSSH 3.5.2 on Ubuntu 24.04, natively and in an unprivileged Incus container, with the unit unchanged and the profile enforced, including a read-only and a read-write local directory source and a read-write source on an SSHFS share. They are a starting point, not a maintained artifact: after every update run the profile in complain mode first and look for denials.
-
Fail closed first. Without a drop-in, systemd starts WebSSH unconfined when the profile is not loaded, and nothing tells you. With this drop-in (
systemctl edit webssh) the service does not start instead (status=231/APPARMOR):[Service] AppArmorProfile=webssh
-
What WebSSH needs (applies to an SELinux policy in the same way):
Access Why /usr/local/bin/websshmap and readthe program; a profile attached to this path also covers the systemd-runcommands andwebssh healthcheckDATA_DIR/**read, write, lock and link (rwkl)database, keys, logs, audit; the first start creates secret_keywith a hard linkBACKUP_TEMP_DIR/**read, write, lockbackup and restore staging TCP and UDP over IPv4 and IPv6 listener, SSH, SFTP, SMB, LDAP, OIDC, DNS netlink raw sockets route checks of the tailnet rule; without them tailnet targets are refused (the abstraction nameserviceallows them)/etc/hosts,/etc/resolv.conf,/etc/nsswitch.conf, CA certificates,/usr/share/zoneinfonames, TLS to identity providers, TZ/proc/sys/kernel/random/boot_id,/proc/self/{stat,cgroup,mountinfo},/proc/sys/net/core/somaxconn, cgroupcpu.maxandmemory.maxrecognising the host WebSSH runs on, Go runtime limits signals from systemd, signals to itself stop; the Go runtime signals its own threads /dev/ttyprompts of create-adminandreset-passwordwith--ptyWebSSH runs no other program and needs no capabilities,
ptraceormount. Uploads and downloads write nothing on the WebSSH host, except into local directory sources. -
Paths you choose must be in the profile when they lie outside the two directories: password files of
create-adminandreset-password,LDAP_BIND_PASSWORD_FILE,LDAP_CA_FILE,OIDC_CLIENT_SECRET_FILE, backup targets and archives to restore. The same holds for local directory sources: the fileLOCAL_SOURCES_FILEnames needs read access, each read-only sourceron the directory and below it, each read-write sourcerwl(the link permission keeps renames atomic on NFS and SSHFS). A source the profile leaves out is shown as No access for the WebSSH account and the kernel log has a deniedopenof its directory. -
In a container the profile needs the flag
attach_disconnected; without it the service does not start there, because the sandbox's mount namespace leaves inherited descriptors outside the container's root. In an unprivileged Incus container on Ubuntu the profile can be loaded inside the container (install theapparmorpackage there), with and without nesting; the host stacks it on the container's own profile. Proxmox VE was not checked.
Example profile, to be saved as /etc/apparmor.d/webssh; adjust the two
directory variables if webssh.env sets other ones:
abi <abi/4.0>,
include <tunables/global>
# DATA_DIR and BACKUP_TEMP_DIR of /etc/webssh/webssh.env.
@{WEBSSH_DATA}=/var/lib/webssh
@{WEBSSH_RECOVERY}=/var/lib/webssh-recovery
# attach_disconnected: in a container, the mount namespace of the unit's
# sandbox leaves inherited descriptors (/dev/null, the journal socket)
# outside the container's root; without the flag the start fails there.
profile webssh /usr/local/bin/webssh flags=(attach_disconnected, complain) {
include <abstractions/base>
include <abstractions/nameservice>
include <abstractions/ssl_certs>
# HTTP listener, SSH, SFTP, SMB, LDAP, OIDC and DNS.
network inet stream,
network inet6 stream,
network inet dgram,
network inet6 dgram,
# Route lookup of the network policy (tailnet rule, Tailscale SSH).
network netlink raw,
# Stop and reload by systemd; the Go runtime signals its own threads.
signal (receive) peer=unconfined,
signal (send, receive) peer=webssh,
/usr/local/bin/webssh mr,
# Data and the recovery directory, owned by the webssh account. The first
# start creates DATA_DIR/secret_key with a hard link (l).
owner @{WEBSSH_DATA}/ rw,
owner @{WEBSSH_DATA}/** rwkl,
owner @{WEBSSH_RECOVERY}/ rw,
owner @{WEBSSH_RECOVERY}/** rwk,
# "backup create" without a target first tries the parent of DATA_DIR
# and falls back to BACKUP_TEMP_DIR; the unit keeps the parent read-only.
deny /var/lib/.webssh-backup-probe-*/ w,
# Go runtime: listen backlog, CPU and memory limits of the cgroup.
@{PROC}/sys/net/core/somaxconn r,
@{sys}/fs/cgroup/{,**/}{cpu.max,memory.max} r,
@{sys}/fs/cgroup/{cpu,cpuacct,cpu\,cpuacct,memory}/{,**/}{cpu.cfs_quota_us,cpu.cfs_period_us,memory.limit_in_bytes} r,
# Recognising the host WebSSH runs on (automation) and the cgroup limits.
@{PROC}/sys/kernel/random/boot_id r,
owner @{PROC}/@{pid}/{stat,cgroup,mountinfo} r,
# Secret files named in the settings, for example
# LDAP_BIND_PASSWORD_FILE, LDAP_CA_FILE, OIDC_CLIENT_SECRET_FILE,
# and password files of create-admin outside the two directories.
# /etc/webssh/ldap/* r,
# Local directory sources: LOCAL_SOURCES_FILE, then r for a read-only
# source and rwl for a read-write one, with the paths of that file. The
# link permission (l) lets renames on NFS and SSHFS stay atomic.
# /etc/webssh/local-sources.json r,
# /srv/media/ r,
# /srv/media/** r,
# /srv/dropbox/ rw,
# /srv/dropbox/** rwl,
# Interactive prompts of create-admin and reset-password (systemd-run --pty).
/dev/tty rw,
}
apparmor_parser -r /etc/apparmor.d/webssh
systemctl restart webssh
journalctl -k -g 'profile="webssh"' # or /var/log/audit/audit.log
aa-enforce /etc/apparmor.d/webssh # once a full round of use shows no denialIn complain mode the Go runtime logs many signal entries until
signal (send, receive) peer=webssh is in the profile; keep that rule when
you build a profile of your own.
systemctl disable --now webssh
rm -f /etc/systemd/system/webssh.service /usr/local/bin/webssh
rm -rf /etc/systemd/system/webssh.service.d
systemctl daemon-reload/var/lib/webssh, /var/lib/webssh-recovery, /etc/webssh and the account
webssh stay until you remove them yourself.
Docker inside an unprivileged container needs the container features for nested containers:
| Platform | Setting |
|---|---|
| Proxmox VE | pct set <id> --features nesting=1 |
| Incus | incus config set <name> security.nesting=true |
On Proxmox VE 9.3 nesting=1 is enough for WebSSH with
docker-compose.yml, also together with docker-compose.hardened.yml;
keyctl=1 is not needed (tested with Docker CE 29.10.1 in a Debian 12
container). On Incus 7.7 security.nesting=true is enough for WebSSH with
docker-compose.yml, also together with docker-compose.hardened.yml.
security.syscalls.intercept.mknod=true and
security.syscalls.intercept.setxattr=true are optional; some other images
need them. Incus 6.0.0 from the Ubuntu 24.04 archive cannot start any Docker
container on a bridge network (runc create failed: … open sysctl net.ipv4.ip_unprivileged_port_start file: … permission denied); use a
current Incus release there.
Then install Docker in the container and follow Docker and Docker Compose and, for HTTPS, Production Deployment. The data lives in the Docker volumes inside the container; back it up as described there or with the whole container.
WebSSH documentation - Project - Issues - Discussions - Security
This Wiki is published from the versioned docs/wiki source. Please propose documentation changes through a pull request.
WebSSH Wiki
Install
- Docker and Docker Compose
- Install on Unraid
- Install in LXC, Incus or Proxmox
- Production Deployment
- Reverse Proxy and Subfolder Deployment
Update
Use WebSSH
- Overview and Dashboard
- SSH Connections and Host Keys
- Profiles, Jump Hosts and Commands
- Terminal and Persistent tmux Sessions
- SFTP and SMB File Workspace and Transfers
- Local Directories
- Automation
- Saved Passwords
- Herdr Integration
- Tailscale SSH
Accounts and sign-in
- Authentication Overview
- Users and Account Management
- Account Access Controls
- Passkeys, Authenticator Apps and Recovery Codes
- OpenID Connect
- GitHub Authentication
- LDAP and Active Directory
Operate
- Health Checks and Troubleshooting
- Backup, Restore and Secret Rotation
- Administration, Audit and Diagnostics
- Configuration Reference
- Data Storage and Persistence
- Security Model and Hardening
Contribute