Authentication
Sign in, import sessions from existing browsers, and manage encrypted credentials.
semrush-cli uses authenticated web sessions rather than developer API keys. Session state is managed by a background Galleton daemon and encrypted locally on disk.
Interactive login
For machines with a graphical desktop environment, launch the browser sign-in flow:
semrush setup
semrush auth login
semrush auth status --check --jsonThe CLI opens a dedicated browser window to the Semrush sign-in page. Enter your credentials directly in the browser. Once sign-in succeeds, the CLI verifies the session, stores the encrypted session cookies in Galleton, and closes the browser window.
Importing an existing browser session
If you work on a headless server or already have an active Semrush session in Chromium, import it via Chrome DevTools Protocol (CDP):
semrush auth import --cdp-url http://127.0.0.1:9234
semrush doctorThe target browser must run with remote debugging enabled on a loopback address. For security, non-loopback hosts and remote endpoints are rejected.
Remote headless servers
To authenticate on a remote headless machine, start Chromium with remote debugging on your local computer, run this reverse SSH tunnel from your local computer:
ssh -N -R 127.0.0.1:9234:127.0.0.1:9234 user@remote-serverKeep the tunnel open. It forwards the remote server's loopback port to your local browser. In a separate terminal on the remote host, execute:
semrush auth import --cdp-url http://127.0.0.1:9234The import command connects to the forwarded port, captures the authenticated cookies, and verifies your account.
Session validation and multilogin
Verify session status at any time:
semrush auth status --check --json
semrush doctor --jsonIf Semrush redirects an authentication check to /multilogin/, multiple concurrent sessions have been detected. The CLI refuses to confirm session takeover automatically. Resolve the prompt manually in your primary browser, then run semrush auth login or reimport the updated session.
Storage and security
- Encryption: Sessions are stored in a local vault using AES-256-GCM encryption in
~/.local/share/semrush-cli/galleton. - Ephemeral contexts: Each command initializes a short-lived browser context from stored cookies. No persistent browser profile is modified on your system.
- Process isolation: Only local processes authorized with the daemon API token can request sessions.
Managing the daemon
Control the local session service directly:
semrush auth logout
semrush daemon stop
semrush daemon startLogging out removes the CLI profile from Galleton without ending sessions in your regular web browsers.
Environment configuration
Override default paths and endpoints using environment variables:
| Variable | Default | Purpose |
|---|---|---|
SEMRUSH_GALLETON_URL | http://127.0.0.1:8771 | Galleton daemon loopback API endpoint |
SEMRUSH_GALLETON_TOKEN_FILE | ~/.local/share/semrush-cli/galleton/api.token | Path to local daemon API token |
SEMRUSH_SESSION | semrush-cli | Named session identifier |
SEMRUSH_BROWSER_EXECUTABLE | Bundled Chromium | Path to custom Chromium binary |