Server Tools: CLI Reference
All commands and options of Server Tools as tables: db, vhost, user, ssl, cron, firewall, fail2ban, logs, status as well as install, uninstall, --version, --config and --help.
CLI Reference
All commands require root, except --version, --help and --config. Global flags (--yes, --quiet) and the behavior on errors are described under Usage. <command> --help shows the action list of the command. Exceptions: status ignores arguments and always shows the status, and vhost audit --help only prints a usage line and exits with code 1.
General
| Command | Description |
|---|---|
install |
Installs the tool system-wide, see Installation |
uninstall |
Removes binary, shortcuts and libraries |
--version, -v |
Shows the version |
--config, -c |
Shows the active configuration |
--help, -h |
Shows the help |
| (no arguments) | Starts the interactive menu |
db (alias database)
Details: Databases
| Command | Description |
|---|---|
db create --name <db> --user <user> [--password <pw>] |
Create database and user, write credential file |
db create-for-user --name <db> --user <user> |
Create a database for an existing user |
db delete --name <db> [--user <user>] [--drop-user] |
Delete a database. With --user its privileges are revoked, with --user and --drop-user the user is deleted |
db backup --name <db> |
Dump to ST_DB_BACKUP_DIR |
db backup-all |
Back up all user databases |
db restore --name <db> --file <path> |
Load a dump into an existing database, with confirmation |
db import --name <db> --file <path> |
Load a SQL file into an existing database, without confirmation |
db export --name <db> [--output <path>] |
Export a database as .sql or .sql.gz |
db list |
List databases and users |
db info --name <db> |
Size, table count, users with access, credential file |
db grant --name <db> --user <user> [--level all\|readonly\|readwrite] |
Grant privileges, default all |
db grants --user <user> |
Show the privileges of a user |
vhost
Details: Virtual hosts
| Command | Description |
|---|---|
vhost create --domain <d> [--type php\|proxy] [--php <v>] [--aliases "<a b>"] [--docroot <path>] |
Create a PHP VHost |
vhost create --domain <d> --type proxy --backend <url> [--websocket] [--preserve-host true\|false] [--aliases "<a b>"] |
Create a reverse proxy VHost |
vhost delete --domain <d> |
Delete a VHost |
vhost list |
Active and available sites |
vhost php --domain <d> --version <v> |
Change the PHP version |
vhost info --domain <d> |
Type, DocumentRoot or backend, PHP, SSL, status |
vhost redirect --from <d> --to <url> [--code 301\|302] |
Create a redirect VHost |
vhost audit [--domain <d>] |
Check VHost configuration against the template, all VHosts without --domain |
user
Details: SSH users
| Command | Description |
|---|---|
user create --domain <d> --username <u> |
Create a domain user |
user delete --username <u> |
Delete a domain user |
user list |
List domain users |
user add-key --username <u> --key "<public key>" |
Add an SSH key |
user set-password --username <u> [--password <pw>] |
Set or generate a password |
user info --username <u> |
Show details |
ssl
Details: SSL certificates
| Command | Description |
|---|---|
ssl create --domain <d> [--email <mail>] |
Create a certificate via certbot |
ssl delete --domain <d> |
Delete a certificate |
ssl wildcard --domain <d> [--provider <name>] |
Wildcard certificate via DNS challenge |
ssl list |
List certificates |
ssl check [--days <n>] |
Check certificates that expire in at most n days, default 30 |
ssl renew |
Set up the daily renewal cron job |
cron
Details: Cron jobs
| Command | Description |
|---|---|
cron add --schedule '<min h dom mon dow>' --command '<cmd>' --name '<name>' |
Create a cron file in /etc/cron.d |
cron remove --pattern <text> |
Remove files in /etc/cron.d that contain the text |
cron list |
Show cron files and the root crontab |
firewall (alias fw)
Details: Firewall, Fail2Ban, logs, status
| Command | Description |
|---|---|
firewall status |
ufw status verbose |
firewall allow --port <n> [--proto tcp\|udp] |
Allow a port |
firewall deny --port <n> [--proto tcp\|udp] |
Deny a port |
fail2ban (alias f2b)
| Command | Description |
|---|---|
fail2ban status |
Jails with currently and total banned IPs |
fail2ban banned |
Banned IPs per jail |
fail2ban unban --ip <ipv4> |
Unban an IP from all jails |
logs (alias log)
| Command | Description |
|---|---|
logs webserver [--domain <d>] [--lines <n>] [--errors] |
Webserver access log, with --errors the error log. Alias apache |
logs webserver-errors [--domain <d>] [--lines <n>] |
Webserver error log. Alias apache-errors |
logs mysql [--lines <n>] |
MySQL error log |
logs audit [--lines <n>] [--filter <text>] |
Audit log |
logs search --pattern <text> [--domain <d>] [--lines <n>] |
Search the webserver error log, MySQL log and audit log, with --domain the logs of that domain |
status
| Command | Description |
|---|---|
status |
Services, resources, versions, configuration, backups |