Skip to content

Command Line Reference

Marc Pope edited this page Jul 26, 2026 · 1 revision

Command-line reference

Run these with php artisan from the application directory. In Docker, prefix with docker compose exec cortendesk.

Several of these are the way back in when the console itself will not let you sign in, so it is worth knowing they exist before you need them.

Break-glass

Reset two-factor for a user

php artisan cortendesk:2fa-reset <username>

Disables TOTP on that account so they can sign in with their password and re-enrol. This is the answer to "the administrator lost their phone" and it does not require console access.

Turn emailed sign-in verification off

php artisan cortendesk:email-verification off
php artisan cortendesk:email-verification on
php artisan cortendesk:email-verification        # report current state

Use off when mail has broken while emailed sign-in codes are required — otherwise nobody can complete a sign-in. Run with no argument to report the current state and relay health.

Disable SSO

Not an artisan command — an environment variable:

CORTENDESK_OIDC_DISABLED=true

Forces SSO off regardless of stored settings and restores the password form. Needed when password sign-in has been disabled and the identity provider is unreachable; see Single sign-on.

Maintenance

Prune audit logs

php artisan cortendesk:prune-logs
php artisan cortendesk:prune-logs --days=90     # override the configured window

Deletes rows older than the retention window across connections, file transfers, logins, alarms and the console audit trail. Deletes in chunks so it does not lock tables on a large install. Does nothing when retention is 0 (keep forever).

Runs nightly on the scheduler.

Prune invitations and trusted devices

php artisan cortendesk:prune-invitations

Removes expired invitations, long-accepted ones, and expired trusted-device records. Hygiene only — expiry is enforced at redemption regardless.

Close stale sessions

php artisan cortendesk:close-stale-sessions

Closes sessions belonging to devices that have stopped heartbeating — a machine that was rebooted, unplugged or had its service stopped never reports its session closed, so without this it would show as active indefinitely.

Runs every five minutes on the scheduler.

Migration

Import from lejianwen/rustdesk-api

php artisan cortendesk:import-lejianwen <path-to-sqlite-db>

Imports users (with passwords intact), devices, address books and audit history. See Importing from rustdesk-api.

The scheduler

Everything above marked "runs on the scheduler" needs Laravel's scheduler running.

  • Docker — already running inside the container. Nothing to do.
  • Manual install — add the cron entry, or none of the scheduled jobs ever run:
* * * * * cd /path/to/cortendesk && php artisan schedule:run >> /dev/null 2>&1

Without it, logs grow forever and sessions from powered-off machines pile up as permanently active.

Related

Clone this wiki locally