Skip to content

Environments

Environments allow you to manage multiple isolated profiles within bssh. Each environment maintains its own independent database of connections, tags, aliases, session history, and default configuration.

Every environment is stored in its own directory under ~/.config/bayesian-ssh/environments/<name>/:

  • history.db: An independent SQLite database containing:
    • Saved connections and credentials
    • Tags and groups
    • Short aliases
    • Past session history and durations
    • Configured inventory sources
  • config.json: Profile-specific settings, including:
    • Default SSH username and port
    • Default bastion and bastion username
    • Search mode (bayesian or fuzzy)
    • Session recording settings
    • Context prediction settings

The built-in initial environment is named default. Your currently active environment is tracked in ~/.config/bayesian-ssh/active_env.

Run bssh env list to view all available environments. The currently active profile is marked with an asterisk:

bssh env list
Environments:
client-a
* default (active)

Run bssh env create with a unique name to initialize a new profile:

bssh env create client-a
✅ Created new environment 'client-a'
To start using it, run: bayesian-ssh env use client-a

Creating an environment generates a clean history.db database and a fresh config.json pre-populated with standard defaults.

Run bssh env use to switch your active profile:

bssh env use client-a
✅ Now using environment 'client-a'

Once switched, all subsequent bssh commands operate on the selected environment’s database until changed again.

Run bssh env remove to delete an environment and its stored database:

bssh env remove client-a
🗑️ Removed environment 'client-a'

bssh enforces safety constraints when deleting environments:

  • You cannot delete the currently active environment. Switch to another environment first.
  • You cannot delete the built-in default environment.
# Switch profile from the terminal
bssh env use client-a

To run a single command in another environment without switching your persistent active profile, pass the --env flag:

# List connections in the client-b environment
bssh --env client-b list
# Connect to a host stored in client-b
bssh --env client-b connect db-prod
# Check reachability of hosts in client-b
bssh --env client-b ping --all

The --env flag takes precedence for that execution only. Your active environment remains unchanged.

  • Client separation: Consultants and agencies can maintain dedicated environments for each client (client-acme, client-beta). Connections, bastion routes, and aliases never mix or appear in another client’s search results.
  • Work and personal: Keep your personal home lab and hobby VPS instances completely isolated from corporate production infrastructure.
  • Compliance and audits: Configure strict session recording and mandatory bastion routes in a production environment, while leaving a sandbox environment unrestricted.