This guide helps you get bssh-server running quickly.
- Linux operating system (x86_64 or aarch64)
- Root or sudo access for port 22, or use alternative port (e.g., 2222)
- OpenSSH client for testing (
sshcommand)
# Download the latest release
curl -LO https://github.com/lablup/bssh/releases/latest/download/bssh-server-linux-amd64.tar.gz
# Extract
tar xzf bssh-server-linux-amd64.tar.gz
# Install to system
sudo mv bssh-server /usr/local/bin/
sudo mv bssh-keygen /usr/local/bin/
# Verify installation
bssh-server version
bssh-keygen --version# Clone the repository
git clone https://github.com/lablup/bssh.git
cd bssh
# Build with Cargo
cargo build --release --bin bssh-server --bin bssh-keygen
# Install binaries
sudo cp target/release/bssh-server /usr/local/bin/
sudo cp target/release/bssh-keygen /usr/local/bin/sudo mkdir -p /etc/bssh
sudo chmod 755 /etc/bsshHost keys are required for the SSH server to identify itself to clients.
# Generate Ed25519 key (recommended)
sudo bssh-server gen-host-key -t ed25519 -o /etc/bssh/ssh_host_ed25519_key
# Optionally generate RSA key for compatibility
sudo bssh-server gen-host-key -t rsa -o /etc/bssh/ssh_host_rsa_key# Generate configuration template
sudo bssh-server gen-config -o /etc/bssh/server.yamlEdit /etc/bssh/server.yaml and configure authentication:
auth:
methods:
- publickey
publickey:
# Use standard authorized_keys location
authorized_keys_pattern: "/home/{user}/.ssh/authorized_keys"Ensure the user's public key is in their ~/.ssh/authorized_keys file.
First, generate a password hash:
bssh-server hash-password
# Enter your password when prompted
# Copy the generated hashThen edit the configuration:
auth:
methods:
- password
password:
users:
- name: myuser
password_hash: "$argon2id$v=19$m=19456,t=2,p=1$..." # paste hash here# Start in foreground for testing
sudo bssh-server -c /etc/bssh/server.yaml -D -v
# Or run as daemon
sudo bssh-server -c /etc/bssh/server.yamlHere's a minimal working configuration:
# /etc/bssh/server.yaml
server:
bind_address: "0.0.0.0"
port: 2222
host_keys:
- /etc/bssh/ssh_host_ed25519_key
auth:
methods:
- publickey
publickey:
authorized_keys_pattern: "/home/{user}/.ssh/authorized_keys"
shell:
default: /bin/bash
sftp:
enabled: true
scp:
enabled: true# From another terminal or machine
ssh -p 2222 youruser@localhost
# With verbose output for debugging
ssh -v -p 2222 youruser@localhostsftp -P 2222 youruser@localhost# Upload a file
scp -P 2222 localfile.txt youruser@localhost:/tmp/
# Download a file
scp -P 2222 youruser@localhost:/etc/hostname ./-
Check if the port is already in use:
sudo lsof -i :2222
-
Verify host key permissions:
ls -la /etc/bssh/ssh_host_* # Should be -rw------- (600)
-
Validate configuration:
bssh-server check-config -c /etc/bssh/server.yaml
-
Check verbose output from client:
ssh -vvv -p 2222 user@localhost
-
For public key auth, verify:
- Public key is in
~/.ssh/authorized_keys - File permissions:
~/.sshis 700,authorized_keysis 600 - Home directory is not world-writable
- Public key is in
-
For password auth, verify:
- Password hash is correct (regenerate with
bssh-server hash-password) - Username matches exactly
- Password hash is correct (regenerate with
Run server in foreground with verbose logging:
sudo bssh-server -c /etc/bssh/server.yaml -D -vvv- Server Configuration Guide - Complete configuration reference
- Security Guide - Security best practices
- Container Deployment - Docker and Kubernetes deployment
- Audit Logging - Setting up audit logging
Create /etc/systemd/system/bssh-server.service:
[Unit]
Description=Backend.AI SSH Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/bssh-server -c /etc/bssh/server.yaml -D
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
User=root
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable bssh-server
sudo systemctl start bssh-server
sudo systemctl status bssh-serverView logs:
sudo journalctl -u bssh-server -f