Skip to content

OpenSSH Server

Description / nameInput element
Container Registry
Container Configuration Root Path
Timezone
User ID
Group ID
OpenSSH Server Host Port
OpenSSH Server /config Path

Build Status Last Commit OCI Pulls

SSH and SFTP into a container: one user, key or password login, optional sudo.

Port 2222
Registry ghcr.io/daemonless/openssh-server
Daemonless daemonless/openssh-server
Source openssh/openssh-portable
Website www.openssh.com

Version Tags

Multi-arch manifests — resolve automatically to the right image for your platform.

Tag Description Best For
latest / pkg FreeBSD Quarterly. openssh-portable from stable, tested packages. Most users — recommended.
pkg-latest FreeBSD Latest. openssh-portable, rolling package updates. Alternative build.
pkg-hpn HPN-SSH, quarterly. High-performance networking patches: faster bulk transfers over high-latency links. Alternative build.
pkg-latest-hpn HPN-SSH, latest. High-performance networking patches, rolling package updates. Alternative build.
Tag Description Best For
latest-amd64 / pkg-amd64 FreeBSD Quarterly. openssh-portable from stable, tested packages. Most users — recommended.
pkg-latest-amd64 FreeBSD Latest. openssh-portable, rolling package updates. Alternative build.
pkg-hpn-amd64 HPN-SSH, quarterly. High-performance networking patches: faster bulk transfers over high-latency links. Alternative build.
pkg-latest-hpn-amd64 HPN-SSH, latest. High-performance networking patches, rolling package updates. Alternative build.
Tag Description Best For
latest-aarch64 / pkg-aarch64 FreeBSD Quarterly. openssh-portable from stable, tested packages. Most users — recommended.
pkg-latest-aarch64 FreeBSD Latest. openssh-portable, rolling package updates. Alternative build.
pkg-hpn-aarch64 HPN-SSH, quarterly. High-performance networking patches: faster bulk transfers over high-latency links. Alternative build.
pkg-latest-hpn-aarch64 HPN-SSH, latest. High-performance networking patches, rolling package updates. Alternative build.

Before deploying, ensure your host environment is ready. See the Quick Start Guide for host setup instructions, including the security model for host vs. container privileges.

Deployment

services:
  openssh-server:
    image: "ghcr.io/daemonless/openssh-server:latest"
    container_name: openssh-server
    environment:
      - PUID=1000  # User ID of the login user
      - PGID=1000  # Group ID of the login user
      - TZ=UTC  # Timezone for the container
      - USER_NAME=bsd  # Login user name (default: bsd)
      - PUBLIC_KEY=ssh-ed25519 AAAA... you@example  # A public key added to authorized_keys
      - PASSWORD_ACCESS=false  # true allows password login (default: false, keys only)
      - SUDO_ACCESS=false  # true gives the user sudo (with password if one is set)
      # - PUBLIC_KEY_FILE=  # A file of public keys to add (works with secrets)
      # - PUBLIC_KEY_DIR=  # A directory of public key files to add
      # - PUBLIC_KEY_URL=  # A URL of public keys to add (e.g. https://github.com/<user>.keys)
      # - USER_PASSWORD=  # The user's password (random if unset)
      # - USER_PASSWORD_FILE=  # A file holding the password; wins over USER_PASSWORD
      # - LISTEN_PORT=  # Port sshd listens on (default: 2222)
      # - UMASK=  # umask for SFTP uploads (default: 022)
    volumes:
      - "/containers/openssh-server:/config"
    ports:
      - "2222:2222"
    # always (not unless-stopped) so FreeBSD's podman rc.d auto-starts it at boot
    restart: always

Save as compose.yaml, then run podman-compose up -d.

Warning

Exposing ports in AppJail means that your service can be reached from remote hosts. If that is not your intention, do not expose the ports and communicate with the service using the jail's IPv4 address or hostname assigned by the virtual network.

# .env

DIRECTOR_PROJECT=openssh-server
PUID=1000
PGID=1000
TZ=UTC
USER_NAME=bsd
PUBLIC_KEY=ssh-ed25519 AAAA... you@example
PASSWORD_ACCESS=false
SUDO_ACCESS=false
# appjail-director.yml

options:
  - virtualnet: ':<random> default'
  - nat:
services:
  openssh-server:
    name: openssh_server
    options:
      - container: 'args:--pull'
      - expose: '2222:2222 proto:tcp'
    oci:
      user: root
      environment:
        - PUID: !ENV '${PUID}'
        - PGID: !ENV '${PGID}'
        - TZ: !ENV '${TZ}'
        - USER_NAME: !ENV '${USER_NAME}'
        - PUBLIC_KEY: !ENV '${PUBLIC_KEY}'
        - PASSWORD_ACCESS: !ENV '${PASSWORD_ACCESS}'
        - SUDO_ACCESS: !ENV '${SUDO_ACCESS}'
    volumes:
      - OPENSSH_SERVER_CONFIG_PATH: /config
volumes:
  OPENSSH_SERVER_CONFIG_PATH:
    device: '/containers/openssh-server'
1
2
3
4
5
6
7
# Makejail

ARG tag=latest

OPTION container=boot
OPTION overwrite=force
OPTION from=ghcr.io/daemonless/openssh-server:${tag}

Save the files above, then run appjail-director up.

Experimental

Bastille's OCI support is experimental. It requires buildah and shares the host network stack (inherit). Mount volumes with --volume HOST JAIL; without it, image-declared volumes are stored under ${bastille_volumesdir}/${jail}.

services:
  openssh-server:
    name: openssh-server
    image: "ghcr.io/daemonless/openssh-server:latest"
    network:
      - mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - USER_NAME=bsd
      - PUBLIC_KEY=ssh-ed25519 AAAA... you@example
      - PASSWORD_ACCESS=false
      - SUDO_ACCESS=false
    volumes:
      - "/containers/openssh-server:/config"

Save as bastille-compose.yml, then run bastille up.

Interactive Configuration

Parameters

Environment Variables

Variable Default Description
PUID 1000 User ID of the login user
PGID 1000 Group ID of the login user
TZ UTC Timezone for the container
USER_NAME bsd Login user name (default: bsd)
PUBLIC_KEY ssh-ed25519 AAAA... you@example A public key added to authorized_keys
PASSWORD_ACCESS false true allows password login (default: false, keys only)
SUDO_ACCESS false true gives the user sudo (with password if one is set)
PUBLIC_KEY_FILE <PUBLIC_KEY_FILE> A file of public keys to add (works with secrets)
PUBLIC_KEY_DIR <PUBLIC_KEY_DIR> A directory of public key files to add
PUBLIC_KEY_URL <PUBLIC_KEY_URL> A URL of public keys to add (e.g. https://github.com/.keys)
USER_PASSWORD <USER_PASSWORD> The user's password (random if unset)
USER_PASSWORD_FILE <USER_PASSWORD_FILE> A file holding the password; wins over USER_PASSWORD
LISTEN_PORT `` Port sshd listens on (default: 2222)
UMASK `` umask for SFTP uploads (default: 022)

Volumes

Path Description
/config Home directory, authorized_keys, host keys and sshd_config

Ports

Port Protocol Description
2222 TCP SSH

Implementation Details

  • Architectures: amd64, aarch64
  • User: bsd (UID/GID set via PUID/PGID). Defaults to 1000:1000.
  • Base: Built on ghcr.io/daemonless/base (FreeBSD 15.1).

Need help? Join our Discord community.