-
-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Reference
BBS provides a suite of command-line tools for installation, updates, backups, and administrative tasks.
Performs a complete installation of BBS on a fresh Ubuntu 22.04+ server.
Location: Installer script (not installed with BBS)
Usage:
sudo bash bbs-install [--hostname HOST] [--no-ssl]Options:
| Option | Description |
|---|---|
--hostname HOST |
Set server hostname (default: prompts interactively) |
--no-ssl |
Skip SSL certificate installation (for LAN/development) |
What It Does:
- Installs system packages (Apache, PHP 8.1+, MySQL, Composer, etc.)
- Configures Apache with virtual host
- Clones BBS repository to
/var/www/bbs/ - Runs Composer to install PHP dependencies
- Configures MySQL database
- Generates
.envconfiguration (includingAPP_KEY) - Sets up file permissions
- Installs SSL certificate via Certbot (unless
--no-ssl) - Configures cron job for scheduler
- Runs database schema migration
Requirements:
- Fresh Ubuntu 22.04+ installation
- Root or sudo access
- Internet connectivity
- Valid domain name (for SSL)
Examples:
# Interactive installation with prompts
sudo bash bbs-install
# Automated installation with hostname
sudo bash bbs-install --hostname bbs.example.com
# LAN installation without SSL
sudo bash bbs-install --hostname bbs.local --no-sslUpdates the BBS server to a new version or branch.
Location: /var/www/bbs/bin/bbs-update
Usage:
sudo /var/www/bbs/bin/bbs-update [path] [branch/tag]Arguments:
| Argument | Description |
|---|---|
path |
Installation path (default: /var/www/bbs/) |
branch/tag |
Git branch or tag to checkout (default: latest release tag) |
What It Does:
- Fetches latest code from GitHub
- Checks out specified tag or branch
- Runs
composer install --no-dev --optimize-autoloader - Fixes file permissions on
/var/www/bbs/ - Updates SSH helper script in
/usr/local/bin/ - Updates sudoers configuration for
www-data - Checks and installs/updates rclone if needed
- Runs pending database migrations from
migrations/ - Fixes permissions on
/var/bbs/storage directory - Restarts PHP-FPM service
Update Modes:
Production (Latest Release):
sudo /var/www/bbs/bin/bbs-updateDevelopment (Main Branch):
sudo /var/www/bbs/bin/bbs-update /var/www/bbs mainSpecific Version:
sudo /var/www/bbs/bin/bbs-update /var/www/bbs v0.9.4-betaExamples:
# Update to latest stable release
sudo /var/www/bbs/bin/bbs-update
# Update to development branch (beta server)
sudo /var/www/bbs/bin/bbs-update /var/www/bbs main
# Rollback to previous version
sudo /var/www/bbs/bin/bbs-update /var/www/bbs v0.9.3-betaCreates a backup of the BBS server (database, config, version).
Location: /var/www/bbs/bin/bbs-backup
Usage:
sudo /var/www/bbs/bin/bbs-backup [backup_dir]Arguments:
| Argument | Description |
|---|---|
backup_dir |
Directory to store backup (default: /var/bbs/backups/) |
What It Does:
- Creates MySQL dump of entire BBS database
- Copies
/var/www/bbs/config/.envto archive - Copies
/var/www/bbs/VERSIONto archive - Creates compressed archive:
bbs-backup-YYYY-MM-DD_HHMMSS.tar.gz - Deletes backups older than 7 most recent
Backup Contents:
-
database.sql- Complete MySQL dump -
config.env- Configuration file withAPP_KEY -
VERSION- Server version identifier
Examples:
# Default location (/var/bbs/backups/)
sudo /var/www/bbs/bin/bbs-backup
# Custom location
sudo /var/www/bbs/bin/bbs-backup /root/bbs-backups/
# One-time backup before update
sudo /var/www/bbs/bin/bbs-backup /tmp/pre-update/Automation:
- Runs automatically daily via
scheduler.php - No manual intervention needed for routine backups
Restores BBS server from a backup archive.
Location: /var/www/bbs/bin/bbs-restore
Usage:
sudo /var/www/bbs/bin/bbs-restore <backup.tar.gz>Arguments:
| Argument | Description |
|---|---|
backup.tar.gz |
Path to backup archive |
Prerequisites:
- BBS must be installed first (run
bbs-install) - Valid backup archive from
bbs-backup - Root or sudo access
What It Does:
- Extracts
VERSIONfrom backup - Checks out matching code version from git
-
Prompts: Restore
config/.env? (y/n)- If yes, overwrites
/var/www/bbs/config/.env
- If yes, overwrites
-
Prompts: Restore database? (y/n)
- If yes, drops existing tables and imports
database.sql
- If yes, drops existing tables and imports
- Recreates Unix SSH users for all agents (e.g.,
bbs-1,bbs-2) - Restores SSH authorized keys from database
- Runs
bbs-updateif backup version is older than current release - Fixes storage permissions on
/var/bbs/
Examples:
# Restore from local backup
sudo /var/www/bbs/bin/bbs-restore /var/bbs/backups/bbs-backup-2026-02-01_120000.tar.gz
# Restore from downloaded backup
sudo /var/www/bbs/bin/bbs-restore /tmp/bbs-backup-2026-02-01_120000.tar.gzInteractive Prompts:
Restore config/.env? (y/n): y
Restore database? (y/n): y
Use Cases:
- Disaster recovery after hardware failure
- Server migration to new hardware
- Rollback after catastrophic misconfiguration
Emergency tool to disable two-factor authentication for a locked-out user.
Location: /var/www/bbs/bin/bbs-2fa-reset
Usage:
sudo /var/www/bbs/bin/bbs-2fa-reset <username>Arguments:
| Argument | Description |
|---|---|
username |
Username of account to reset |
What It Does:
- Connects to MySQL database
- Sets
totp_enabled = 0for the specified user - Clears
totp_secretfor the user - User can now log in without 2FA code
Examples:
# Reset 2FA for admin user
sudo /var/www/bbs/bin/bbs-2fa-reset admin
# Reset 2FA for locked-out user
sudo /var/www/bbs/bin/bbs-2fa-reset jdoeWhen to Use:
- User lost access to authenticator app
- User cannot generate valid TOTP codes
- Emergency admin access needed
Security Note:
- Only use when absolutely necessary
- Re-enable 2FA immediately after regaining access
- Log administrative actions
Internal utility for Unix user management, SSH keys, Borg operations, and rclone sync.
Location: /usr/local/bin/bbs-ssh-helper
Usage: Not typically called manually (used by web application)
Subcommands:
| Subcommand | Description |
|---|---|
create-user <id> <key> |
Create Unix user bbs-<id> with SSH key |
create-repo-dir <id> |
Create repository directory /var/bbs/repos/<id>
|
borg-extract <id> <archive> <path> <dest> |
Extract files from Borg archive |
fix-repo-perms <id> |
Fix permissions on repository directory |
delete-user <id> |
Delete Unix user bbs-<id>
|
rclone-sync |
Sync backups/repositories to S3 |
delete-storage <path> |
Delete repository storage directory |
How It Works:
- Installed by
bbs-updateto/usr/local/bin/ -
www-datauser has passwordless sudo access via/etc/sudoers.d/bbs - Web application invokes via
sudo bbs-ssh-helper <subcommand>
Examples (Internal Use):
# Create agent user (called by web app)
sudo bbs-ssh-helper create-user 1 "ssh-rsa AAAAB3..."
# Extract file from Borg (called during restore)
sudo bbs-ssh-helper borg-extract 1 myarchive path/to/file /tmp/restore/
# Sync to S3 (called by scheduler)
sudo bbs-ssh-helper rclone-syncManual Use (Troubleshooting):
# Fix repository permissions manually
sudo bbs-ssh-helper fix-repo-perms 5
# Manually sync to S3
sudo bbs-ssh-helper rclone-syncCron-driven task runner that executes periodic server operations.
Location: /var/www/bbs/scheduler.php
Usage: Runs automatically via cron (every minute)
Cron Configuration:
* * * * * /usr/bin/php /var/www/bbs/scheduler.php >> /var/log/bbs-scheduler.log 2>&1What It Does:
| Task | Frequency | Description |
|---|---|---|
| Schedule Checks | Every minute | Process due backup plans, create jobs |
| Agent Offline Detection | Every 3x poll interval | Mark agents offline, send notifications |
| Notification Cleanup | Daily | Delete notifications older than 30 days |
| Borg Version Sync | Weekly | Fetch latest Borg releases from GitHub |
| Daily Self-Backup | Daily (00:00) | Run bbs-backup
|
| S3 Server Backup Sync | Daily (after backup) | Sync /var/bbs/backups/ to S3 |
| Storage Monitoring | Hourly | Check disk space, warn if low |
| Log Cleanup | Daily | Rotate/delete old log files |
Logs:
- Output:
/var/log/bbs-scheduler.log - Rotated by logrotate
Manual Execution:
# Run scheduler manually (for testing)
sudo -u www-data /usr/bin/php /var/www/bbs/scheduler.phpTroubleshooting:
# Check cron status
sudo systemctl status cron
# View scheduler log
tail -f /var/log/bbs-scheduler.log
# Verify cron job exists
sudo crontab -u www-data -l | grep scheduler# Restart Apache
sudo systemctl restart apache2
# Check status
sudo systemctl status apache2
# View error log
sudo tail -f /var/log/apache2/error.log# Restart PHP-FPM
sudo systemctl restart php8.1-fpm
# Check status
sudo systemctl status php8.1-fpm
# View PHP-FPM log
sudo journalctl -u php8.1-fpm -f# Access MySQL
sudo mysql
# Restart MySQL
sudo systemctl restart mysql
# Check status
sudo systemctl status mysql# View agent status
systemctl status bbs-agent
# View agent logs
journalctl -u bbs-agent -f
# Restart agent
sudo systemctl restart bbs-agent# Backup first
sudo /var/www/bbs/bin/bbs-backup /root/pre-update/
# Update to latest release
sudo /var/www/bbs/bin/bbs-update
# Verify version
cat /var/www/bbs/VERSION# 1. Install on new server
sudo bash bbs-install --hostname bbs.example.com
# 2. Transfer backup
scp backup.tar.gz root@newserver:/tmp/
# 3. Restore
sudo /var/www/bbs/bin/bbs-restore /tmp/backup.tar.gz# Reset user's 2FA
sudo /var/www/bbs/bin/bbs-2fa-reset admin
# User can now log in without 2FA
# Instruct user to re-enable in Settings → Security- Updating BBS - Update procedures
- Server Backup and Restore - Backup and restore details
- Installation - Initial server setup
- Troubleshooting - Common issues
📖 User Manual
Getting Started
Using BBS
- Dashboard
- Managing Clients
- Linux Agent Setup
- macOS Agent Setup
- Windows Agent Setup
- Repositories
- Backup Plans
- Restoring Files
- Database Backups
- Plugins
- Remote Storage
- S3 Offsite Sync
Monitoring
Administration
Reference