---
title: "Using the SiteWorx Command Line Interface (CLI)"
source: "https://docs.nexcess.com/hosting/control-panel/interworx/siteworx/using-the-siteworx-command-line-interface-cli/"
description: "Discover the SiteWorx CLI: A powerful command-line tool for managing individual SiteWorx accounts, ideal for automation and scripting."
vertical: "Hosting"
date: "2025-05-29"
last_modified: "2026-06-30"
---

# Using the SiteWorx Command Line Interface (CLI)

The SiteWorx Command Line Interface (CLI) is a powerful tool that allows you to manage various aspects of an individual SiteWorx account directly from the command line. This can be useful for automation, scripting, or for users who prefer working in a terminal environment.

## Accessing the SiteWorx CLI

You can run SiteWorx CLI commands in two ways, depending on your user privileges:

### As the root user

When operating as the `root` user, you must specify the primary domain of the SiteWorx account you wish to manage. This is done using the `--login_domain` flag, along with the `-u` flag (which typically implies the SiteWorx user context). The `-h` flag can be used to display help information.

```

siteworx --login_domain mydomain.com -u -h

```

Replace `mydomain.com` with the actual primary domain of the SiteWorx account.

### As the non-root Unix user

If you are logged in as the specific non-root Unix user that owns the SiteWorx account, you can run commands more directly. You will still use the `-u` flag.

```

siteworx -u -h

```

## Command structure

The general syntax for SiteWorx CLI commands is:

```

siteworx [user_identifier_flags] -c [Controller] -a [Action] [additional_flags]

```

- `[user_identifier_flags]`: This includes `-u` and, if running as root, `--login_domain <domain_name>`.
- `-c [Controller]`: Specifies the main module or section of SiteWorx you want to interact with (e.g., Email, Dns, Ftp).
- `-a [Action]`: Specifies the operation you want to perform within that controller (e.g., add, list, delete).
- `[additional_flags]`: These are specific options required or accepted by the chosen action.

Below is a comprehensive list of available controllers, actions, and their respective flags.

---

## Index controller

Manages basic login and session information.

### login

Logs into the SiteWorx account.

- **Additional flags:**
    - `--login_email <string>`: The email address for the SiteWorx account.
    - `--login_password <string>`: The password for the SiteWorx account.
    - `--login_domain <string>`: The primary domain of the SiteWorx account (required if not implicitly known).
- **Example Usage:** `siteworx -u -c Index -a login --login_email user@example.com --login_password "yourpassword" --login_domain example.com`

### sso

Initiates a Single Sign-On session.

- **Example Usage:** `siteworx -u -c Index -a sso`

### getSession

Retrieves current session information.

- **Example Usage:** `siteworx -u -c Index -a getSession`

### validateTwoFactor

Validates a two-factor authentication code.

- **Additional flags:**
    - `--code <integer>`: The two-factor authentication code.
- **Example Usage:** `siteworx -u -c Index -a validateTwoFactor --code 123456`

---

## Overview controller

Provides general information and management options for the SiteWorx account.

### listMasterDomain

Displays the master domain for the account.

- **Example Usage:** `siteworx -u -c Overview -a listMasterDomain`

### listWorkingDomain

Displays the current working domain.

- **Example Usage:** `siteworx -u -c Overview -a listWorkingDomain`

### listVersion

Displays the SiteWorx version.

- **Example Usage:** `siteworx -u -c Overview -a listVersion`

### listLicenseKey

Displays the SiteWorx license key information.

- **Example Usage:** `siteworx -u -c Overview -a listLicenseKey`

### listAvailableDiskSpace

Displays the available disk space for the account.

- **Example Usage:** `siteworx -u -c Overview -a listAvailableDiskSpace`

### listAccountDetails

Displays various details about the SiteWorx account.

- **Example Usage:** `siteworx -u -c Overview -a listAccountDetails`

### listPhpInstallMode

Displays the PHP installation mode for the account.

- **Example Usage:** `siteworx -u -c Overview -a listPhpInstallMode`

### queryAccountConfig

Queries specific account configuration settings.

- **Additional flags:**
    - `--config_name <string>`: The name of the configuration setting to query.
- **Example Usage:** `siteworx -u -c Overview -a queryAccountConfig --config_name cgi`

### listAccountConfig

Lists all account configuration settings.

- **Example Usage:** `siteworx -u -c Overview -a listAccountConfig`

### editProfile

Edits the SiteWorx user profile settings.

- **Additional flags:**
    - `--language <string>`: Sets the interface language (e.g., `en-us`, `es`, `fr`). Options: `ru|de|es|pl|nl|sk|sv|hu|it|pt|en-us|fr|zh|da|tr|cs`.
    - `--menu_style <string>`: Sets the menu style. Options: `big|small`.
    - `--password <string>`: Sets a new password.
    - `--confirm_password <string>`: Confirms the new password.
    - `--ssh_public_key <string>`: Adds an SSH public key (one key per line if multiple, though typically one input here).
- **Example Usage:** `siteworx -u -c Overview -a editProfile --language en-us --menu_style big`

### queryEditProfile

Queries the current profile settings that can be edited.

- **Additional flags:** (These flags likely pre-fill or filter the query, rather than set values) 
    - `--language <string>`
    - `--menu_style <string>`
    - `--password <string>`
    - `--confirm_password <string>`
    - `--ssh_public_key <string>`
- **Example Usage:** `siteworx -u -c Overview -a queryEditProfile`

---

## Email Controller

Manages general email settings for the account.

### editBounce

Enables or disables the master bounce email address for the account.

- **Additional flags:**
    - `--enablebounce <string>`: Set to `1` to enable, `0` to disable.
- **Example Usage:** `siteworx -u -c Email -a editBounce --enablebounce 1`

### queryEditBounce

Queries the current master bounce email setting.

- **Additional flags:**
    - `--enablebounce <string>`: Likely used to check a specific state if needed, or no flag to get current.
- **Example Usage:** `siteworx -u -c Email -a queryEditBounce`

---

## EmailBox controller

Manages individual email mailboxes (POP/IMAP accounts).

### add

Adds a new email mailbox.

- **Additional flags:**
    - `--username <string>`: The username for the email account (e.g., `user` for `user@example.com`).
    - `--password <string>`: The password for the email account.
    - `--confirm_password <string>`: Confirms the email account password.
    - `--diskspacequota <integer>`: The disk space quota in Megabytes (MB).
    - `--copyto <string>`: Email address(es) to forward copies of incoming mail to (one per line if multiple, though typically one input here).
- **Example Usage:** `siteworx -u -c EmailBox -a add --username newuser --password "complexpassword123" --confirm_password "complexpassword123" --diskspacequota 1024`

### edit

Modifies an existing email mailbox.

- **Additional flags:**
    - `--username <string>`: The username of the mailbox to edit (e.g., `matttest`, `postmaster`). (Other flags from ‘add’ can be used here to change specific settings).
- **Example Usage (to change password):** `siteworx -u -c EmailBox -a edit --username matttest --password "newcomplexpassword" --confirm_password "newcomplexpassword"`

### delete

Deletes an email mailbox.

- **Additional flags:**
    - `--username <string>`: The username of the mailbox to delete.
- **Example Usage:** `siteworx -u -c EmailBox -a delete --username matttest`

### list

Lists email mailboxes with formatting options.

- **Additional flags:**
    - `--datasource <string>`: Data source for listing (often defaults to all).
    - `--format <string>`: Output format. Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailBox -a list --format values`

### listEmailBoxes

Lists all email mailboxes (a simpler alternative to `list`).

- **Example Usage:** `siteworx -u -c EmailBox -a listEmailBoxes`

---

## EmailAlias controller

Manages email aliases (forwarders).

### add

Adds a new email alias.

- **Additional flags:**
    - `--username <string>`: The alias name (e.g., `alias` for `alias@example.com`).
    - `--forwardsto <string>`: The email address(es) to forward to (comma-separated for multiple).
- **Example Usage:** `siteworx -u -c EmailAlias -a add --username sales --forwardsto user1@example.com,user2@anotherdomain.com`

### edit

Modifies an existing email alias.

- **Additional flags:**
    - `--username <string>`: The alias name to edit. (Use `--forwardsto` to change forwarding destinations).
- **Example Usage:** `siteworx -u -c EmailAlias -a edit --username sales --forwardsto newuser@example.com`

### delete

Deletes an email alias.

- **Additional flags:**
    - `--username <string>`: The alias name to delete.
- **Example Usage:** `siteworx -u -c EmailAlias -a delete --username sales`

### list

Lists email aliases with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailAlias -a list`

### listEmailAliases

Lists all email aliases.

- **Example Usage:** `siteworx -u -c EmailAlias -a listEmailAliases`

### queryEdit

Queries an existing email alias for editing purposes.

- **Additional flags:**
    - `--username <string>`: The alias name to query.
- **Example Usage:** `siteworx -u -c EmailAlias -a queryEdit --username sales`

---

## EmailGroup controller

Manages email groups (multiple forwarders under one address).

### add

Adds a new email group.

- **Additional flags:**
    - `--username <string>`: The group email address name (e.g., `team` for `team@example.com`).
    - `--forwardsto <string>`: Email addresses to include in the group (one per line if inputting directly, comma-separated for CLI).
- **Example Usage:** `siteworx -u -c EmailGroup -a add --username projectalpha --forwardsto member1@example.com,member2@example.com`

### edit

Modifies an existing email group.

- **Additional flags:**
    - `--username <string>`: The group name to edit. (Use `--forwardsto` to change members).
- **Example Usage:** `siteworx -u -c EmailGroup -a edit --username projectalpha --forwardsto member1@example.com,member3@example.com`

### delete

Deletes an email group.

- **Additional flags:**
    - `--username <string>`: The group name to delete.
- **Example Usage:** `siteworx -u -c EmailGroup -a delete --username projectalpha`

### list

Lists email groups with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailGroup -a list`

### listEmailGroups

Lists all email groups.

- **Example Usage:** `siteworx -u -c EmailGroup -a listEmailGroups`

---

## EmailAutorespond controller

Manages email autoresponders.

### add

Adds a new autoresponder.

- **Additional flags:**
    - `--username <string>`: The email address for which to set the autoresponder (e.g., `info` for `info@example.com`).
    - `--copyto <string>`: Email address(es) to also send a copy of the incoming mail to (one per line if multiple, comma-separated for CLI).
    - `--autorespondmessage <string>`: The text of the auto-reply message.
- **Example Usage:** `siteworx -u -c EmailAutorespond -a add --username vacation --autorespondmessage "I am currently out of office."`

### edit

Modifies an existing autoresponder.

- **Additional flags:**
    - `--username <string>`: The email address whose autoresponder to edit. (Use other flags to change settings).
- **Example Usage:** `siteworx -u -c EmailAutorespond -a edit --username vacation --autorespondmessage "I will be back on Monday." --copyto manager@example.com`

### delete

Deletes an autoresponder.

- **Additional flags:**
    - `--username <string>`: The email address whose autoresponder to delete.
- **Example Usage:** `siteworx -u -c EmailAutorespond -a delete --username vacation`

### list

Lists autoresponders with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailAutorespond -a list`

### listEmailAutoresponders

Lists all autoresponders.

- **Example Usage:** `siteworx -u -c EmailAutorespond -a listEmailAutoresponders`

---

## DomainsSlave controller

Manages secondary (add-on) domains.

### add

Adds a new secondary domain.

- **Additional flags:**
    - `--domain <string>`: The domain name to add (e.g., `www.anotherdomain.com` or `anotherdomain.com`). Do not include `http://`.
    - `--php_version <string>`: PHP version for the domain. Options typically include `system-php` or specific versions like `/opt/remi/php74`, `/opt/remi/php80`, etc. (Available options may vary based on server setup).
    - `--ipv4 <string>`: Specific IPv4 address to assign.
    - `--ipv6 <string>`: Specific IPv6 address to assign (`0` often means none or default).
    - `--ipv6_from_pool <string>`: Assign IPv6 from available pool (often `1` for yes, `0` for no, or specific pool ID).
- **Example Usage:** `siteworx -u -c DomainsSlave -a add --domain newdomain.com --php_version system-php`

### edit

Modifies settings for a secondary domain (e.g., PHP version).

- **Additional flags:**
    - `--domain <string>`: The secondary domain to edit (e.g., `newiwx.mattjung.net`, `secondary.com`). (Use flags similar to ‘add’ to change specific settings like `--php_version`).
- **Example Usage:** `siteworx -u -c DomainsSlave -a edit --domain secondary.com --php_version /opt/remi/php74`

### delete

Deletes a secondary domain.

- **Additional flags:**
    - `--domain <string>`: The secondary domain to delete.
- **Example Usage:** `siteworx -u -c DomainsSlave -a delete --domain secondary.com`

### list

Lists secondary domains with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c DomainsSlave -a list`

### setConfig

Sets configuration options for a secondary domain (details depend on available configurations).

- **Additional flags:**
    - `--domain <string>`: The secondary domain to configure. (Additional flags for specific configurations will be needed).
- **Example Usage:** `siteworx -u -c DomainsSlave -a setConfig --domain secondary.com`

### deleteConfig

Deletes configuration options for a secondary domain.

- **Additional flags:**
    - `--domain <string>`: The secondary domain whose configuration to delete.
- **Example Usage:** `siteworx -u -c DomainsSlave -a deleteConfig --domain secondary.com`

### queryConfig

Queries existing configurations for a secondary domain.

- **Additional flags:**
    - `--domain <string>`: The secondary domain to query.
- **Example Usage:** `siteworx -u -c DomainsSlave -a queryConfig --domain secondary.com`

### listConfig

Lists all configurations for a secondary domain.

- **Additional flags:**
    - `--domain <string>`: The secondary domain.
- **Example Usage:** `siteworx -u -c DomainsSlave -a listConfig --domain secondary.com`

### listSecondaryDomains

Lists all secondary domains.

- **Example Usage:** `siteworx -u -c DomainsSlave -a listSecondaryDomains`

### listIds

Lists IDs related to secondary domains.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c DomainsSlave -a listIds`

### queryEdit

Queries settings of a secondary domain for editing purposes.

- **Additional flags:**
    - `--domain <string>`: The secondary domain.
- **Example Usage:** `siteworx -u -c DomainsSlave -a queryEdit --domain secondary.com`

---

## DomainsPointer controller

Manages pointer (parked/aliased) domains.

### add

Adds a new pointer domain.

- **Additional flags:**
    - `--domain <string>`: The pointer domain name (e.g., `parkeddomain.com`). Do not include `http://www.` prefix here, just the domain.
    - `--redir_type <string>`: Type of redirection or alias. Options: `redirect_301` (permanent redirect), `redirect_302` (temporary redirect), `server_alias` (domain serves content from another).
    - `--points_to <string>`: The target domain or URL this pointer domain should point to (required for redirects).
    - `--create_mail_alias <string>`: Whether to create mail aliases for this pointer domain. Options: `1` (yes), `0` (no).
- **Example Usage (301 Redirect):** `siteworx -u -c DomainsPointer -a add --domain parkeddomain.com --redir_type redirect_301 --points_to http://maindomain.com --create_mail_alias 0`
- **Example Usage (Server Alias):** `siteworx -u -c DomainsPointer -a add --domain aliaseddomain.com --redir_type server_alias --points_to maindomain.com --create_mail_alias 1`

### addMailPointerDomain

Specifically enables mail services for a pointer domain.

- **Additional flags:**
    - `--pointer_domain <string>`: The pointer domain for which to enable mail services.
- **Example Usage:** `siteworx -u -c DomainsPointer -a addMailPointerDomain --pointer_domain parkeddomain.com`

### deleteMailPointer

Disables mail services for a pointer domain.

- **Additional flags:**
    - `--pointer_domain <string>`: The pointer domain for which to disable mail services.
- **Example Usage:** `siteworx -u -c DomainsPointer -a deleteMailPointer --pointer_domain parkeddomain.com`

### delete

Deletes a pointer domain.

- **Additional flags:**
    - `--domain <string>`: The pointer domain to delete.
- **Example Usage:** `siteworx -u -c DomainsPointer -a delete --domain parkeddomain.com`

### list

Lists pointer domains with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c DomainsPointer -a list`

### listPointerDomains

Lists all pointer domains.

- **Example Usage:** `siteworx -u -c DomainsPointer -a listPointerDomains`

---

## DomainsSub controller

Manages subdomains.

### add

Adds a new subdomain.

- **Additional flags:**
    - `--prefix <string>`: The prefix for the subdomain (e.g., `blog` for `blog.example.com`).
- **Example Usage:** `siteworx -u -c DomainsSub -a add --prefix store`

### delete

Deletes a subdomain.

- **Additional flags:**
    - `--prefix <string>`: The prefix of the subdomain to delete.
- **Example Usage:** `siteworx -u -c DomainsSub -a delete --prefix store`

### list

Lists subdomains with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c DomainsSub -a list`

### listSubdomains

Lists all subdomains.

- **Example Usage:** `siteworx -u -c DomainsSub -a listSubdomains`

---

## DomainsPhp controller

Manages PHP settings per domain.

### edit

Edits PHP settings for a specific domain (e.g., version, FPM options).

- **Additional flags:**
    - `--domain <string>`: The domain to edit (e.g., `newiwx.mattjung.net`, `secondary.com`, `sub.example.com`).
    - (Additional flags from `listFpmOptions` and `listPhpVersions` would be used here to set values).
- **Example Usage (to change PHP version):** `siteworx -u -c DomainsPhp -a edit --domain mydomain.com --php_version /opt/remi/php80`

### listPhpVersions

Lists available PHP versions that can be assigned to domains.

- **Example Usage:** `siteworx -u -c DomainsPhp -a listPhpVersions`

### listFpmOptions

Lists configurable PHP-FPM options. These flags are used with the `edit` action to set FPM values.

- **Flags for setting values (used with `edit` action):**
    - `--fpm_max_children <integer>`: Max child processes.
    - `--fpm_max_requests <integer>`: Max requests per child.
    - `--fpm_process_management <string>`: Process manager type. Options: `dynamic|static|ondemand`.
    - `--fpm_start_servers <integer>`: Initial number of child processes.
    - `--fpm_min_spare_servers <integer>`: Minimum idle server processes.
    - `--fpm_max_spare_servers <integer>`: Maximum idle server processes.
    - `--fpm_process_idle_timeout <string>`: Idle process timeout (e.g., `10s`).
- **Example Usage (to list available options, not set them):** `siteworx -u -c DomainsPhp -a listFpmOptions`
- **Example Usage (to set FPM options for a domain):** `siteworx -u -c DomainsPhp -a edit --domain mydomain.com --fpm_max_children 10 --fpm_process_management dynamic`

---

## Dns controller

Manages DNS records for zones hosted by SiteWorx.

### listZones

Lists all DNS zones managed by the SiteWorx account.

- **Example Usage:** `siteworx -u -c Dns -a listZones`

### records

Lists DNS records for a specific zone.

- **Additional flags:**
    - `--zone_id <string>`: The ID of the zone (obtainable from `listZones`). E.g., `2`, `3`.
    - `--uni <string>`: Set to `1` or `0` (purpose might be specific to output formatting or record uniqueness, often defaults to a standard view).
- **Example Usage:** `siteworx -u -c Dns -a records --zone_id 2`

### queryDnsRecords

Queries DNS records, similar to `records`, possibly for pre-filling forms or specific data retrieval.

- **Additional flags:**
    - `--zone_id <string>`
    - `--uni <string>`
- **Example Usage:** `siteworx -u -c Dns -a queryDnsRecords --zone_id 2`

**Actions for Adding/Editing DNS Record Types:** For each `add[TYPE]` and `edit[TYPE]` action, you will need to provide the relevant DNS record fields as additional flags (e.g., `--name`, `--content`/`--ip_address`/`--hostname`, `--ttl`, `--prio` for MX).

### addA

Adds an A record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: The hostname (e.g., `www`, `@` for root domain).
    - `--ip_address <string>`: The IPv4 address.
    - `--ttl <integer>`: Time To Live in seconds (e.g., `14400`).
- **Example Usage:** `siteworx -u -c Dns -a addA --zone_id 2 --name www --ip_address 192.0.2.1 --ttl 14400`

### editA

Edits an existing A record.

- **Additional flags:**
    - `--record_id <string>`: The ID of the A record to edit.
    - (Other flags like `--name`, `--ip_address`, `--ttl` to change values).
- **Example Usage:** `siteworx -u -c Dns -a editA --record_id 12 --ip_address 192.0.2.2`

### addAAAA

Adds an AAAA record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`
    - `--ip_address <string>`: The IPv6 address.
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addAAAA --zone_id 2 --name www --ip_address 2001:db8::1 --ttl 14400`

### editAAAA

Edits an existing AAAA record.

- **Additional flags:**
    - `--record_id <string>`
    - (Flags for new values).
- **Example Usage:** `siteworx -u -c Dns -a editAAAA --record_id 13 --ip_address 2001:db8::2`

### addCNAME

Adds a CNAME record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: The alias name.
    - `--hostname <string>`: The target hostname.
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addCNAME --zone_id 2 --name ftp --hostname www.example.com. --ttl 14400`

### editCNAME

Edits an existing CNAME record.

- **Additional flags:**
    - `--record_id <string>`
    - (Flags for new values).
- **Example Usage:** `siteworx -u -c Dns -a editCNAME --record_id 15 --hostname another.example.com.`

### addMX

Adds an MX record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: Usually `@` for the root domain.
    - `--prio <integer>`: Priority (e.g., `10`, `20`). Lower is higher priority.
    - `--exchange <string>`: The mail exchange server hostname.
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addMX --zone_id 2 --name "@" --prio 10 --exchange mail.example.com. --ttl 14400`

### editMX

Edits an existing MX record.

- **Additional flags:**
    - `--record_id <string>`
    - (Flags for new values like `--prio`, `--exchange`).
- **Example Usage:** `siteworx -u -c Dns -a editMX --record_id 19 --prio 5 --exchange newmail.example.com.`

### addSPF

Adds an SPF (TXT) record. Note: SPF records are typically TXT records.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: Usually `@`.
    - `--content <string>`: The SPF string (e.g., `"v=spf1 mx -all"`).
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addSPF --zone_id 2 --name "@" --content ""v=spf1 mx a -all"" --ttl 14400`

### editSPF

Edits an existing SPF (TXT) record.

- **Additional flags:**
    - `--record_id <string>`
    - `--content <string>`: The new SPF string.
- **Example Usage:** `siteworx -u -c Dns -a editSPF --record_id 20 --content ""v=spf1 include:_spf.google.com ~all""`

### addCAA

Adds a CAA record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: Usually `@`.
    - `--flag <integer>`: CAA flag (e.g., `0` or `128`).
    - `--tag <string>`: CAA tag (e.g., `issue`, `issuewild`, `iodef`).
    - `--value <string>`: CAA value (e.g., `"letsencrypt.org"`).
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addCAA --zone_id 2 --name "@" --flag 0 --tag issue --value ""letsencrypt.org"" --ttl 14400`

### editCAA

Edits an existing CAA record.

- **Additional flags:**
    - `--record_id <string>`
    - (Flags for new values).
- **Example Usage:** `siteworx -u -c Dns -a editCAA --record_id 21 --value ""sectigo.com""`

### addSRV

Adds an SRV record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`: Service and protocol (e.g., `_sip._tls`).
    - `--priority <integer>`
    - `--weight <integer>`
    - `--port <integer>`
    - `--target <string>`: The target hostname.
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addSRV --zone_id 2 --name "_autodiscover._tcp" --priority 0 --weight 0 --port 443 --target "autodiscover.example.com." --ttl 3600`

### editSRV

Edits an existing SRV record.

- **Additional flags:**
    - `--record_id <string>`
    - (Flags for new values).
- **Example Usage:** `siteworx -u -c Dns -a editSRV --record_id 22 --port 5061`

### addTXT

Adds a TXT record.

- **Additional flags:**
    - `--zone_id <string>`
    - `--name <string>`
    - `--content <string>`: The text content.
    - `--ttl <integer>`
- **Example Usage:** `siteworx -u -c Dns -a addTXT --zone_id 2 --name dkim._domainkey --content ""v=DKIM1; k=rsa; p=YourPublicKeyData"" --ttl 14400`

### editTXT

Edits an existing TXT record.

- **Additional flags:**
    - `--record_id <string>`
    - `--content <string>`: The new text content.
- **Example Usage:** `siteworx -u -c Dns -a editTXT --record_id 46 --content ""New TXT content""`

### add

A generic add action, likely for adding a new DNS zone if the domain isn’t already set up for DNS.

- **Additional flags:**
    - `--domain <string>`: The domain to add a zone for (e.g., `newiwx.mattjung.net`, `secondary.com`).
- **Example Usage:** `siteworx -u -c Dns -a add --domain newdnszone.com`

### delete

Deletes a DNS record.

- **Additional flags:**
    - `--record_id <string>`: The ID of the DNS record to delete. This ID is obtained from listing records.
- **Example Usage:** `siteworx -u -c Dns -a delete --record_id 12`

**Query Edit Actions for DNS Records:** These actions (`queryEditA`, `queryEditAAAA`, etc.) are used to retrieve the current values of a specific record, often for pre-filling edit forms or for inspection.

- **Common Additional flag:**
    - `--record_id <string>`: The ID of the record to query.
- **Example Usage (queryEditA):** `siteworx -u -c Dns -a queryEditA --record_id 12`

---

## Ssl controller

Manages SSL certificates for domains.

### generateLetsEncrypt

Generates and installs a Let’s Encrypt SSL certificate for a domain.

- **Additional flags:**
    - `--domain <string>`: The domain to secure (e.g., `newiwx.mattjung.net`, `secondary.com`). This will typically try to include `www.domain.com` as well if applicable.
- **Example Usage:** `siteworx -u -c Ssl -a generateLetsEncrypt --domain example.com`

### install

Installs a manually provided SSL certificate, key, and optional chain certificate for a domain.

- **Additional flags:**
    - `--domain <string>`: The domain for which to install the SSL certificate.
    - `--chain <string>`: Whether a chain/intermediate certificate is being provided. Options: `1` (yes), `0` (no).
    - You will need to use the SslKey, SslCrt, and SslChain controllers (see below) to first install the respective components (private key, certificate, chain certificate) if they are not already in SiteWorx. This command then associates them with the domain.
- **Example Usage (assuming key, crt, chain are already uploaded via SslKey, SslCrt, SslChain controllers):** `siteworx -u -c Ssl -a install --domain example.com --chain 1`

### uninstall

Uninstalls (removes) the SSL certificate from a domain. This does not necessarily delete the certificate components from SiteWorx storage, but disassociates them from the domain.

- **Additional flags:**
    - `--domain <string>`: The domain from which to uninstall the SSL certificate.
- **Example Usage:** `siteworx -u -c Ssl -a uninstall --domain example.com`

### listSslInfo

Lists SSL information for domains in the SiteWorx account.

- **Example Usage:** `siteworx -u -c Ssl -a listSslInfo`

---

## SslKey controller

Manages SSL Private Keys.

### getSslKey

Retrieves a stored SSL private key. The flag description `-----END PRIVATE KEY-----` suggests it might be used to identify a key if multiple are stored without explicit names, or it’s a placeholder for the key content itself in some contexts.

- **Example Usage (more context needed for typical use):** `siteworx -u -c SslKey -a getSslKey`

### generate

Generates a new SSL private key.

- **Additional flags:**
    - `--key_length <string>`: The desired key length in bits. Options: `2048|3072|4096`.
- **Example Usage:** `siteworx -u -c SslKey -a generate --key_length 2048` *Note: After generation, you’ll typically use this key to generate a CSR.*

### install

Installs an existing SSL private key into SiteWorx.

- **Additional flags:**  
    
    - `--key <string>`: The private key content itself (e.g., “`-----BEGIN PRIVATE KEY-----n...n-----END PRIVATE KEY-----`“). It’s often easier to paste this into a file and use `--key "(cat your_key_file.key)"`.
- **Example Usage:** `siteworx -u -c SslKey -a install --key "-----BEGIN PRIVATE KEY-----nMIIC...n-----END PRIVATE KEY-----"`

### delete

Deletes a stored SSL private key. Be cautious, as this may affect installed SSL certificates.

- **Example Usage (more context needed for typical use, might require an identifier):** `siteworx -u -c SslKey -a delete`

---

## SslChain controller

Manages SSL Chain/Intermediate Certificates.

### getSslChain

Retrieves a stored SSL chain certificate.

- **Example Usage (more context needed):** `siteworx -u -c SslChain -a getSslChain </pre><br></br></li><br></br></ul><br></br><h3>install</h3><br></br><p>Installs an SSL chain certificate into SiteWorx.</p> Additional flags: --chain <string>: The chain certificate content (e.g., "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"). Use --chain "(cat your_chain_file.pem)"` for file input.

**Example Usage:**

```
siteworx -u -c SslChain -a install --chain "-----BEGIN CERTIFICATE-----nMIID...n-----END CERTIFICATE-----"
```

### delete

Deletes a stored SSL chain certificate.

- **Example Usage (more context needed):** `siteworx -u -c SslChain -a delete`

---

## SslCrt controller

Manages SSL Certificates (CRTs).

### getSslCrt

Retrieves a stored SSL certificate.

- **Example Usage (more context needed):** `siteworx -u -c SslCrt -a getSslCrt`

### generate

Generates a self-signed SSL certificate. This is generally not recommended for public-facing websites but can be used for testing or internal purposes. You typically need a private key first.

- **Example Usage (assumes a key is available/generated):** `siteworx -u -c SslCrt -a generate`

### install

Installs an SSL certificate into SiteWorx.

- **Additional flags:**  
    
    - `--crt <string>`: The certificate content (e.g., “`-----BEGIN CERTIFICATE-----n...n-----END CERTIFICATE-----`“). Use `--crt "(cat your_cert_file.crt)"` for file input.
- **Example Usage:** `siteworx -u -c SslCrt -a install --crt "-----BEGIN CERTIFICATE-----nMIID...n-----END CERTIFICATE-----"`

### delete

Deletes a stored SSL certificate.

- **Example Usage (more context needed):** `siteworx -u -c SslCrt -a delete`

---

## SslCsr controller

Manages SSL Certificate Signing Requests (CSRs).

### getSslCsr

Retrieves a stored/generated SSL CSR.

- **Example Usage (more context needed, might require domain/identifier):** `siteworx -u -c SslCsr -a getSslCsr`

### generate

Generates a new SSL CSR. This requires a private key to exist or be generated first. The CSR is then sent to a Certificate Authority (CA) to obtain an SSL certificate.

- **Additional flags:**
    - `--countryName <string>`: Two-letter country code (e.g., `US`, `CA`).
    - `--stateOrProvinceName <string>`: Full state or province name (e.g., `California`).
    - `--localityName <string>`: City or locality name (e.g., `Los Angeles`).
    - `--organizationName <string>`: Legal organization name (e.g., `My Company Inc`).
    - `--organizationalUnitName <string>`: Department or unit name (e.g., `IT Department`). Optional.
    - `--commonName <string>`: The fully qualified domain name (FQDN) to be secured (e.g., `www.example.com` or `example.com`). For wildcard, use `*.example.com`.
    - `--subjectAltName <string>`: Subject Alternative Names (SANs). Additional hostnames to be secured by the certificate, comma-separated (e.g., `example.com,www.example.com,blog.example.com`).
    - `--emailAddress <string>`: Administrative contact email.
- **Example Usage:** `siteworx -u -c SslCsr -a generate --countryName US --stateOrProvinceName "Michigan" --localityName "Lansing" --organizationName "My Web Company" --commonName www.mydomain.com --subjectAltName "mydomain.com,www.mydomain.com" --emailAddress admin@mydomain.com</pre><br></br></li><br></br></ul><br></br><h3>install</h3><br></br><p>Installs an existing SSL CSR into SiteWorx (less common, as CSRs are usually generated then used externally).</p> Additional flags: --csr <string>: The CSR content. Use --csr "(cat your_csr_file.csr)"` for file input.

**Example Usage:**

```
siteworx -u -c SslCsr -a install --csr "-----BEGIN CERTIFICATE REQUEST-----nMIIC...n-----END CERTIFICATE REQUEST-----"
```

### delete

Deletes a stored SSL CSR.

- **Example Usage (more context needed):** `siteworx -u -c SslCsr -a delete`

### listSslDomains

Lists domains with SSL information, possibly those for which CSRs exist or can be managed.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c SslCsr -a listSslDomains`

---

## Ftp controller

Manages FTP accounts.

### add

Adds a new FTP account.

- **Additional flags:**
    - `--user <string>`: The FTP username. This is often prefixed with the SiteWorx account username (e.g., if SiteWorx user is `myacc`, FTP user `ftpuser` becomes `myacc-ftpuser` or similar, or just `ftpuser@domain.com`). The exact format might depend on server configuration.
    - `--password <string>`: The password for the FTP account.
    - `--confirm_password <string>`: Confirms the FTP password.
    - `--homedir <string>`: The home directory for the FTP user, relative to the SiteWorx account’s root (e.g., `/html/specificfolder` or an absolute path like `/home/unixuser/domain.com/html/specificfolder`). Check panel behavior for relative vs absolute.
- **Example Usage:** `siteworx -u -c Ftp -a add --user newftp --password "ftpSTRONGpassword" --confirm_password "ftpSTRONGpassword" --homedir /html/uploads`

### edit

Modifies an existing FTP account (e.g., change password, home directory).

- **Additional flags:**
    - `--user <string>`: The FTP username to edit. (Use other flags like `--password`, `--homedir` to change values).
- **Example Usage (to change password):** `siteworx -u -c Ftp -a edit --user newftp --password "newFTP!password" --confirm_password "newFTP!password"`

### delete

Deletes an FTP account.

- **Additional flags:**
    - `--user <string>`: The FTP username to delete.
- **Example Usage:** `siteworx -u -c Ftp -a delete --user newftp`

### suspend

Suspends an FTP account, disabling login.

- **Additional flags:**
    - `--user <string>`: The FTP username to suspend.
- **Example Usage:** `siteworx -u -c Ftp -a suspend --user oldftp`

### unsuspend

Unsuspends an FTP account, re-enabling login.

- **Additional flags:**
    - `--user <string>`: The FTP username to unsuspend.
- **Example Usage:** `siteworx -u -c Ftp -a unsuspend --user oldftp`

### list

Lists FTP accounts with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c Ftp -a list`

### listFtpAccounts

Lists all FTP accounts.

- **Example Usage:** `siteworx -u -c Ftp -a listFtpAccounts`

### listDeletable

Lists FTP accounts that are eligible for deletion.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c Ftp -a listDeletable`

### queryEdit

Queries an existing FTP account’s settings for editing.

- **Additional flags:**
    - `--user <string>`: The FTP username to query.
- **Example Usage:** `siteworx -u -c Ftp -a queryEdit --user newftp`

---

## FtpSessions controller

Manages active FTP sessions.

### kill

Terminates active FTP sessions.

- **Additional flags:**
    - `--sessions <string>`: The session ID(s) to kill (obtainable from `listFtpSessions`, likely comma-separated for multiple).
- **Example Usage:** `siteworx -u -c FtpSessions -a kill --sessions "session_id_1,session_id_2"`

### listFtpSessions

Lists currently active FTP sessions.

- **Example Usage:** `siteworx -u -c FtpSessions -a listFtpSessions`

---

## MysqlDb controller

Manages MySQL databases.

### add

Adds a new MySQL database. Optionally creates a new user and grants permissions.

- **Additional flags:**
    - `--name <string>`: The desired database name. It will be prefixed by the system (e.g., `siteworxuser_dbname`). Input only the part after the prefix (e.g., `dbname`).
    - `--create_user <string>`: Whether to create a new MySQL user for this database. Options: `1` (yes), `0` (no).
    - `--user <string>`: If `--create_user=1`, the desired username (will also be prefixed). If `--create_user=0`, an existing MySQL user to grant permissions to.
    - `--password <string>`: Password for the new user (if `--create_user=1`).
    - `--confirm_password <string>`: Confirm password for the new user.
    - `--perms <string>`: Comma-separated list of permissions to grant to the user for this database (e.g., `SELECT,INSERT,UPDATE,DELETE`). Common options include: `SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|REFERENCES|INDEX|ALTER|CREATE TEMPORARY TABLES|LOCK TABLES|CREATE VIEW|SHOW VIEW|CREATE ROUTINE|ALTER ROUTINE|EXECUTE|EVENT|TRIGGER`. Use `ALL PRIVILEGES` for all standard permissions.
    - `--host <string>`: The host from which the user can connect (e.g., `localhost`, `%` for any host). Typically `localhost`.
- **Example Usage (create DB and new user):** `siteworx -u -c MysqlDb -a add --name myappdb --create_user 1 --user myappuser --password "dbPa$wOrd" --confirm_password "dbPa$wOrd" --perms "SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER" --host localhost`

### addFQ

Likely an alternative add method or query for adding a “Fully Qualified” database name (exact behavior might need clarification from system specifics).

- **Example Usage:** `siteworx -u -c MysqlDb -a addFQ`

### listMysqlHost

Lists the MySQL hostname(s) that can be used for connections (e.g., `localhost` or a remote server if configured).

- **Example Usage:** `siteworx -u -c MysqlDb -a listMysqlHost`

### delete

Deletes a MySQL database. **This action is irreversible and will delete all data in the database.**

- **Additional flags:**
    - `--name <string>`: The name of the database to delete (the part after the system prefix, e.g., `myappdb`).
- **Example Usage:** `siteworx -u -c MysqlDb -a delete --name myappdb`

### listMysqlDatabases

Lists all MySQL databases associated with the SiteWorx account.

- **Example Usage:** `siteworx -u -c MysqlDb -a listMysqlDatabases`

### list

Lists MySQL databases with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c MysqlDb -a list`

---

## MysqlUser controller

Manages MySQL users.

### add

Adds a new MySQL user.

- **Additional flags:**
    - `--name <string>`: The desired username (will be prefixed by the system, e.g., `siteworxuser_dbuser`). Input only the part after the prefix.
    - `--password <string>`: Password for the new user.
    - `--confirm_password <string>`: Confirm password.
    - `--host <string>`: (Implicitly, this would be paired with `MysqlPerms` to grant access to databases from specific hosts, default typically `localhost`)
- **Example Usage:** `siteworx -u -c MysqlUser -a add --name newdbuser --password "secureUserPass1" --confirm_password "secureUserPass1"`

### addFQ

Alternative add method or query for “Fully Qualified” user name.

- **Example Usage:** `siteworx -u -c MysqlUser -a addFQ`

### delete

Deletes a MySQL user. This will revoke the user’s access to all databases.

- **Additional flags:**
    - `--name <string>`: The username to delete (part after the prefix).
- **Example Usage:** `siteworx -u -c MysqlUser -a delete --name olddbuser`

### edit

Modifies an existing MySQL user (typically to change the password).

- **Additional flags:**
    - `--name <string>`: The username to edit.
    - `--password <string>`: New password.
    - `--confirm_password <string>`: Confirm new password.
- **Example Usage:** `siteworx -u -c MysqlUser -a edit --name newdbuser --password "updatedSecurePass2" --confirm_password "updatedSecurePass2"`

### listMysqlUsers

Lists all MySQL users associated with the SiteWorx account.

- **Example Usage:** `siteworx -u -c MysqlUser -a listMysqlUsers`

### list

Lists MySQL users with formatting options.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c MysqlUser -a list`

### queryEdit

Queries an existing MySQL user’s settings for editing.

- **Additional flags:**
    - `--name <string>`: The username to query.
- **Example Usage:** `siteworx -u -c MysqlUser -a queryEdit --name newdbuser`

---

## MysqlPerms controller

Manages permissions for MySQL users on databases.

### add

Grants permissions for a user to a database. The user and database must already exist.

- **Additional flags:**
    - `--name <string>`: The database name (part after the prefix).
    - `--user <string>`: The username (part after the prefix).
    - `--host <string>`: Host from which user can connect (e.g., `localhost`, `%`).
    - `--perms <string>`: Comma-separated list of permissions (e.g., `SELECT,INSERT,UPDATE`). Use `ALL PRIVILEGES` for all.
- **Example Usage:** `siteworx -u -c MysqlPerms -a add --name myappdb --user newdbuser --host localhost --perms "SELECT,INSERT,UPDATE,DELETE"`

### edit

Modifies existing permissions for a user on a database.

- **Additional flags:**
    - `--name <string>`: Database name.
    - `--user <string>`: Username.
    - `--host <string>`: Host.
    - `--perms <string>`: New set of comma-separated permissions. This typically overwrites existing permissions for this user/db/host combination.
- **Example Usage:** `siteworx -u -c MysqlPerms -a edit --name myappdb --user newdbuser --host localhost --perms "SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER"`

### delete

Revokes all permissions for a user from a specific database and host.

- **Additional flags:**
    - `--name <string>`: Database name.
    - `--user <string>`: Username.
    - `--host <string>`: Host.
- **Example Usage:** `siteworx -u -c MysqlPerms -a delete --name myappdb --user newdbuser --host localhost`

### queryDatabaseUserPerms

Queries the current permissions a user has on a specific database.

- **Additional flags:**
    - `--name <string>`: Database name.
    - `--user <string>`: Username (optional, to filter by user).
    - `--host <string>`: Host (optional, to filter by host).
- **Example Usage:** `siteworx -u -c MysqlPerms -a queryDatabaseUserPerms --name myappdb --user newdbuser`

### listAvailablePerms

Lists all possible MySQL permissions that can be granted.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c MysqlPerms -a listAvailablePerms`

### queryEdit

Queries existing permissions for a user on a database for editing purposes.

- **Additional flags:**
    - `--name <string>`: Database name.
    - `--user <string>`: Username.
    - `--host <string>`: Host.
- **Example Usage:** `siteworx -u -c MysqlPerms -a queryEdit --name myappdb --user newdbuser --host localhost`

---

## Cron controller

Manages cron jobs (scheduled tasks).

### queryJobs

Lists existing cron jobs.

- **Example Usage:** `siteworx -u -c Cron -a queryJobs`

### queryOptions

Queries configurable options for cron jobs (like shell, path, mailto).

- **Example Usage:** `siteworx -u -c Cron -a queryOptions`

### add

Adds a new cron job.

- **Additional flags:**
    - `--interface <string>`: Type of interface for defining schedule. Options: `simple|advanced`. (Simple might offer presets, advanced allows explicit cron syntax).
    - `--minute <string>`: Minute (0-59). E.g., `*`, `*/15`, `0`.
    - `--hour <string>`: Hour (0-23). E.g., `*`, `*/2`, `0` (midnight).
    - `--day <string>`: Day of the month (1-31). E.g., `*`, `1`, `15`.
    - `--month <string>`: Month (1-12). E.g., `*`, `1` (January).
    - `--dayofweek <string>`: Day of the week (0-6 or 0-7, Sun=0 or 7). E.g., `*`, `1` (Monday).
    - `--script <string>`: The command or script to execute.
- **Example Usage (run a script every day at 2:30 AM):** `siteworx -u -c Cron -a add --minute 30 --hour 2 --day "*" --month "*" --dayofweek "*" --script "/usr/bin/php /home/user/public_html/cron.php"`

### edit

Modifies an existing cron job.

- **Additional flags:**
    - `--job <string>`: The ID or identifier of the cron job to edit (obtainable from `queryJobs` or `list`).
    - (Other flags from `add` to change schedule or script).
- **Example Usage:** `siteworx -u -c Cron -a edit --job "job_id_123" --minute 0 --hour 3 --script "/usr/bin/php /home/user/public_html/updated_cron.php"`

### delete

Deletes one or more cron jobs.

- **Additional flags:**
    - `--jobs <string>`: Comma-separated list of job IDs to delete.
- **Example Usage:** `siteworx -u -c Cron -a delete --jobs "job_id_123,job_id_456"`

### list

Lists existing cron jobs (similar to `queryJobs`, may have different output format).

- **Example Usage:** `siteworx -u -c Cron -a list`

### options

Sets global options for cron jobs, such as the shell to use or email address for output.

- **Additional flags:**
    - `--shell <string>`: Shell to use for cron commands. Options: `/bin/sh|/bin/bash|/usr/bin/sh|/usr/bin/bash|/usr/sbin/jk_chrootsh`.
    - `--path <string>`: System PATH for cron jobs (one per line if multiple, though CLI might take comma-separated or single string).
    - `--mailto <string>`: Email address to send cron output to. Empty string usually disables mail.
- **Example Usage:** `siteworx -u -c Cron -a options --shell /bin/bash --mailto cronalerts@example.com`

### getCurrentSystemTime

Displays the current system time, useful for verifying server time when setting up cron jobs.

- **Example Usage:** `siteworx -u -c Cron -a getCurrentSystemTime`

### queryEdit

Queries an existing cron job’s settings for editing.

- **Additional flags:**
    - `--job <string>`: The ID of the cron job.
- **Example Usage:** `siteworx -u -c Cron -a queryEdit --job "job_id_123"`

---

## Htaccess controller

Manages `.htaccess` file directives for specific directories or globally.

**Common Flag for Htaccess Actions:**

- `--dir <string>`: Specifies the directory context for the .htaccess rule. Can be `global` or a full path like `/home/newiwxma/newiwx.mattjung.net/html`. The available directories are usually predefined within SiteWorx.

### add

Adds a new `.htaccess` managed directory configuration in SiteWorx if it doesn’t exist. This doesn’t add rules itself but prepares a directory for SiteWorx to manage its .htaccess rules through the other actions.

- **Example Usage (if adding a new directory to manage):** `siteworx -u -c Htaccess -a add --dir /home/newiwxma/newiwx.mattjung.net/html/newfolder`

### addPer

Adds a specific directory to be managed by SiteWorx’s .htaccess features.

- **Additional flags:**
    - `--new_dir <string>`: The full path to the new directory to manage (e.g., `/home/newiwxma/newiwx.mattjung.net/html/cgi-bin`).
    - `--status <string>`: Enable (`1`) or disable (`0`) SiteWorx management of .htaccess for this directory.
- **Example Usage:** `siteworx -u -c Htaccess -a addPer --new_dir /home/newiwxma/newiwx.mattjung.net/html/secure_area --status 1`

### edit

Edits existing global or per-directory .htaccess settings through SiteWorx. The specific editable fields depend on the sub-actions (like `accessControl`, `phpVar`, etc.).

- **Example Usage (as a general context for other actions):** `siteworx -u -c Htaccess -a edit --dir global`

### enable

Enables SiteWorx’s management or specific rules within an .htaccess file for a directory.

- **Example Usage:** `siteworx -u -c Htaccess -a enable --dir /home/newiwxma/newiwx.mattjung.net/html`

### disable

Disables SiteWorx’s management or specific rules within an .htaccess file for a directory.

- **Example Usage:** `siteworx -u -c Htaccess -a disable --dir /home/newiwxma/newiwx.mattjung.net/html`

### delete

Removes SiteWorx’s .htaccess management for specified directories.

- **Additional flags:**
    - `--htaccess_dirs <string>`: Comma-separated list of directories (`global` or full paths) to remove management from.
- **Example Usage:** `siteworx -u -c Htaccess -a delete --htaccess_dirs /home/newiwxma/newiwx.mattjung.net/html/old_dir`

### accessControl

Manages IP-based access control (Allow/Deny rules).

- **Additional flags (used with `edit`):**
    - `--allow_ips <string>`: Comma-separated list of IPs/ranges to allow.
    - `--deny_ips <string>`: Comma-separated list of IPs/ranges to deny.
    - `--order <string>`: Order of evaluation (e.g., `Deny,Allow` or `Allow,Deny`).
- **Example Usage:** `siteworx -u -c Htaccess -a edit --dir /home/user/public_html/admin --accessControl --order "Deny,Allow" --deny_ips "all" --allow_ips "192.168.1.100"`

### characterSet

Manages the default character set (e.g., `AddDefaultCharset UTF-8`).

- **Additional flags (used with `edit`):**
    - `--charset <string>`: The character set (e.g., `UTF-8`, `ISO-8859-1`).
- **Example Usage:** `siteworx -u -c Htaccess -a edit --dir global --characterSet --charset UTF-8`

### phpVar

Manages PHP configuration variables set via `php_value` or `php_flag` in .htaccess.

- **Additional flags (used with `edit`):**
    - `--php_vars <string>`: A list/array of PHP variables to set, likely in a specific format like “`variable_name=value,another_variable=value`” or requires repeated flags. Check specific CLI help for exact format.
- **Example Usage (conceptual, actual flags might differ):** `siteworx -u -c Htaccess -a edit --dir /home/user/public_html --phpVar --php_vars "upload_max_filesize=64M,post_max_size=64M"`

### dirIndex

Manages directory index files (e.g., `DirectoryIndex index.html index.php`).

- **Additional flags (used with `edit`):**
    - `--index_files <string>`: Space or comma-separated list of index filenames (e.g., `"index.php index.html default.htm"`).
- **Example Usage:** `siteworx -u -c Htaccess -a edit --dir global --dirIndex --index_files "index.php index.html"`

### hotlink

Manages hotlink protection settings.

- **Additional flags (used with `edit`):**
    - `--enable_hotlink_protection <string>`: `1` to enable, `0` to disable.
    - `--allowed_domains <string>`: Comma-separated list of domains allowed to hotlink.
    - `--blocked_extensions <string>`: Comma-separated list of file extensions to protect (e.g., `jpg,jpeg,gif,png`).
    - `--redirect_url <string>`: URL to redirect blocked requests to (optional).
- **Example Usage:** `siteworx -u -c Htaccess -a edit --dir global --hotlink --enable_hotlink_protection 1 --allowed_domains "mydomain.com,www.mydomain.com" --blocked_extensions "jpg,png,gif"`

### addMimetype / editMimetype / deleteMimetype

Manage custom MIME types (`AddType application/x-httpd-php .html`).

- **addMimetype Example:** `siteworx -u -c Htaccess -a addMimetype --dir global --type "application/font-woff2" --extension ".woff2"`
- **deleteMimetype Example:** `siteworx -u -c Htaccess -a deleteMimetype --dir global --mimetype "application/font-woff2 .woff2"`

### addHandler / editHandler / deleteHandler

Manage Apache handlers (`AddHandler cgi-script .cgi`).

- **addHandler Example:** `siteworx -u -c Htaccess -a addHandler --dir global --handler_name "application/x-httpd-php74" --extensions ".php .phtml"`
- **deleteHandler Example:** `siteworx -u -c Htaccess -a deleteHandler --dir global --handler "application/x-httpd-php74 .php .phtml"`

### addRedirect / editRedirect / deleteRedirect

Manage URL redirects (`Redirect permanent /oldpage.html http://example.com/newpage.html`).

- **addRedirect Example:** `siteworx -u -c Htaccess -a addRedirect --dir global --type permanent --from_path "/old-page.html" --to_url "http://mydomain.com/new-page.html"`
- **deleteRedirect Example:** `siteworx -u -c Htaccess -a deleteRedirect --dir global --redirect "permanent /old-page.html http://mydomain.com/new-page.html"`

**Query Actions for Htaccess:** These actions (`queryGlobalDir`, `queryPerDir`, `queryMimetypes`, etc.) are used to retrieve current .htaccess configurations managed by SiteWorx.

- **Common flag:** `--dir <string>` for context-specific queries.
- **Example (query existing redirects for a directory):** `siteworx -u -c Htaccess -a queryRedirects --dir /home/newiwxma/newiwx.mattjung.net/html`

---

---

## Users controller

Manages SiteWorx sub-users and their permissions.

### add

Adds a new SiteWorx sub-user.

- **Additional flags:**
    - `--nickname <string>`: A display name or nickname for the user.
    - `--email <string>`: The email address for the user (acts as username).
    - `--encrypted <string>`: “y” if the password is ALREADY encrypted, “n” if plain text. Default: `n`.
    - `--password <string>`: Password for the user.
    - `--confirm_password <string>`: Confirm password.
    - `--requires_password_change <string>`: Force password change on first login. Options: `1` (yes), `0` (no).
    - `--language <string>`: Default language for the user.
    - `--menu_style <string>`: Default menu style.
    - `--perms <string>`: Comma-separated list of permissions (e.g., `EMAIL,FTP,MYSQL`). Available: `OVERVIEW|LOGIN|EMAIL|STATS|FTP|LOGS|MYSQL|BACKUP|SUBDOMAINS|PREFERENCES|USERS|FILEMANAGER|POINTERDOMS|CRONTAB|SSL|HTACCESS|SLAVEDOMS|RUBYONRAILS|DNS|PHP|HTTPAUTH|softaculous`.
    - `--locked_domains <string>`: Comma-separated list of domains the user is restricted to, if applicable.
    - `--ssh_enabled <string>`: Enable SSH access for this user. Options: `1` (yes), `0` (no).
    - `--ssh_public_key <string>`: SSH public key for the user.
- **Example Usage:** `siteworx -u -c Users -a add --nickname "Web Developer" --email devuser@example.com --password "devUserPass!" --confirm_password "devUserPass!" --perms "FTP,MYSQL,FILEMANAGER,SSL" --ssh_enabled 1`

### edit

Modifies an existing SiteWorx sub-user.

- **Additional flags:**
    - `--user <string>`: The email address of the user to edit.
    - (Other flags from `add` to change specific settings).
- **Example Usage (to change permissions):** `siteworx -u -c Users -a edit --user devuser@example.com --perms "FTP,MYSQL,FILEMANAGER,SSL,DNS"`

### delete

Deletes a SiteWorx sub-user.

- **Additional flags:**
    - `--user <string>`: Email of the user to delete.
- **Example Usage:** `siteworx -u -c Users -a delete --user olduser@example.com`

### deactivate

Deactivates a sub-user account (disables login but doesn’t delete).

- **Additional flags:**
    - `--user <string>`: Email of the user to deactivate.
- **Example Usage:** `siteworx -u -c Users -a deactivate --user tempuser@example.com`

### activate

Activates a previously deactivated sub-user account.

- **Additional flags:**
    - `--user <string>`: Email of the user to activate.
- **Example Usage:** `siteworx -u -c Users -a activate --user tempuser@example.com`

### login

Generates a login URL or session for a sub-user (exact behavior depends on CLI implementation, might provide a one-time login link).

- **Additional flags:**
    - `--user <string>`: Email of the user to log in as.
- **Example Usage:** `siteworx -u -c Users -a login --user devuser@example.com`

### listUsers

Lists all SiteWorx sub-users.

- **Example Usage:** `siteworx -u -c Users -a listUsers`

### queryEdit

Queries an existing sub-user’s settings for editing.

- **Additional flags:**
    - `--user <string>`: Email of the user to query.
- **Example Usage:** `siteworx -u -c Users -a queryEdit --user devuser@example.com`

### list / listEditable / listDeletable

Various listing options for users with formatting and filtering.

- **Common Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage (list):** `siteworx -u -c Users -a list --format values`

### listWorkingUser / listMasterUser

Displays information about the current acting user or the master SiteWorx user.

- **Example Usage (listWorkingUser):** `siteworx -u -c Users -a listWorkingUser`

---

## Logs controller

Provides access to various server logs visible within SiteWorx.

### view

Views a specific log file.

- **Additional flags:**
    - `--group <string>`: The log group to view (e.g., `Http`, `LetsEncrypt`, `Ftp`, `Email`). The specific log file shown might be the latest or a combined view for that group.
- **Example Usage:** `siteworx -u -c Logs -a view --group Http`

### listLogs

Lists available log groups or log files that can be viewed.

- **Example Usage:** `siteworx -u -c Logs -a listLogs`

---

## Twofactorauth controller

Manages Two-Factor Authentication (2FA) settings for SiteWorx users.

### generate

Generates a new 2FA secret key for a user to set up with an authenticator app. It may also immediately enable 2FA if a valid code is provided.

- **Additional flags:**
    - `--accountusername <string>`: The SiteWorx username (usually email) to set up 2FA for.
    - `--key <string>`: (Optional) A pre-existing 2FA secret key to use. If not provided, one is usually generated.
    - `--code <integer>`: (Optional) An initial code from the authenticator app to verify and enable 2FA immediately.
- **Example Usage (to generate a new key and get QR/secret):** `siteworx -u -c Twofactorauth -a generate --accountusername user@example.com`
- **Example Usage (to verify and enable with a code):** `siteworx -u -c Twofactorauth -a generate --accountusername user@example.com --code 123456`

### delete

Disables/removes Two-Factor Authentication for the current SiteWorx user or a specified user (if permissions allow).

- **Additional flags (potentially):**
    - `--accountusername <string>`: If an admin is disabling for another user.
- **Example Usage (for current user):** `siteworx -u -c Twofactorauth -a delete`

---

## EmailRemotesetup controller

Manages settings for using external mail services (remote mail setup), typically by adjusting MX records and local delivery status.

### addmx / editmx / deletemx

These actions directly manage MX records within the context of remote email setup. They are similar to the Dns controller’s MX actions but might have defaults or behaviors specific to configuring remote mail.

- **addmx Example:** `siteworx -u -c EmailRemotesetup -a addmx --zone_id 2 --name "@" --prio 10 --exchange "remote.mailserver.com." --ttl 3600` *(`--zone_id` is the ID of the domain’s DNS zone)*
- **editmx Example:** `siteworx -u -c EmailRemotesetup -a editmx --record_id 19 --prio 5 --exchange "new.remote.mailserver.com."` *(`--record_id` is the ID of the existing MX record)*
- **deletemx Example:** `siteworx -u -c EmailRemotesetup -a deletemx --record_id 19`

### localDelivery

Configures whether the server should attempt local delivery for emails, or if all mail is handled remotely.

- **Additional flags:**
    - `--local_delivery_status <string>`: Set to `1` to enable local delivery (hybrid setup or mail handled locally), `0` to disable local delivery (all mail handled by remote MX records).
    - `--all_domains <string>`: Apply the setting to all domains in the SiteWorx account (`1`) or just the primary/selected domain (`0`). If `0`, a `--domain` flag might be needed.
- **Example Usage (disable local delivery for all domains):** `siteworx -u -c EmailRemotesetup -a localDelivery --local_delivery_status 0 --all_domains 1`

### enableLocalDelivery / disableLocalDelivery

Fine-grained control over local mail delivery on a per-domain basis.

- **Additional flags:**
    - `--domain <string>`: The specific domain to configure (e.g., `newiwx.mattjung.net`, `secondary.com`).
- **Example Usage (disable local delivery for one domain):** `siteworx -u -c EmailRemotesetup -a disableLocalDelivery --domain secondary.com`
- **Example Usage (enable local delivery for one domain):** `siteworx -u -c EmailRemotesetup -a enableLocalDelivery --domain secondary.com`

### listLocalDeliveryStatus

Shows the current local mail delivery status for domains.

- **Example Usage:** `siteworx -u -c EmailRemotesetup -a listLocalDeliveryStatus`

### listMxRecords

Lists MX records, specifically in the context of remote/local mail setup.

- **Example Usage:** `siteworx -u -c EmailRemotesetup -a listMxRecords`

### listMxRecordIds

Lists IDs of MX records, useful for edit/delete operations.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailRemotesetup -a listMxRecordIds`

### queryEditmx

Queries an existing MX record’s settings for editing.

- **Additional flags:**
    - `--record_id <string>`: The ID of the MX record.
- **Example Usage:** `siteworx -u -c EmailRemotesetup -a queryEditmx --record_id 19`

### queryLocalDelivery

Queries the current local delivery configuration.

- **Additional flags:**
    - `--local_delivery_status <string>` (optional, for checking specific state)
    - `--all_domains <string>` (optional, for context)
- **Example Usage:** `siteworx -u -c EmailRemotesetup -a queryLocalDelivery`

---

## EmailFilters controller

Manages custom email filters based on sender (From) or Subject.

### listFilters

Lists existing email filters.

- **Example Usage:** `siteworx -u -c EmailFilters -a listFilters`

### addFrom

Adds a filter based on the sender’s email address.

- **Additional flags:**
    - `--from-filter <string>`: The email address or pattern to filter (e.g., `spammer@example.com`, `*@baddomain.com`).
- **Example Usage:** `siteworx -u -c EmailFilters -a addFrom --from-filter spammer@baddomain.com`

### addSubject

Adds a filter based on the email’s subject line.

- **Additional flags:**
    - `--subj-filter <string>`: The subject text or pattern to filter (e.g., `"Free Money!"`, `*WINNER*`).
- **Example Usage:** `siteworx -u -c EmailFilters -a addSubject --subj-filter "*URGENT ACTION REQUIRED*"`

### add

A more generic way to add filters, specifying the type.

- **Additional flags:**
    - `--filter_type <string>`: Type of filter. Options: `sender|subject`.
    - `--filter <string>`: The actual filter string (email address or subject pattern).
- **Example Usage:** `siteworx -u -c EmailFilters -a add --filter_type sender --filter another@spammer.org`

### delete

Deletes existing email filters.

- **Additional flags:**
    - `--delete_from <string>`: Comma-separated list of ‘From’ filters to delete.
    - `--delete_subjects <string>`: Comma-separated list of ‘Subject’ filters to delete.
- **Example Usage (delete a ‘From’ filter):** `siteworx -u -c EmailFilters -a delete --delete_from "spammer@baddomain.com"`
- **Example Usage (delete a ‘Subject’ filter):** `siteworx -u -c EmailFilters -a delete --delete_subjects "*URGENT ACTION REQUIRED*"`

### filterBehavior

Defines the action to take when a filter matches (e.g., drop the email, move to spam folder).

- **Additional flags:**
    - `--filter_action <string>`: Action for matched emails. Options: `drop` (delete immediately), `spam` (move to spam folder).
- **Example Usage:** `siteworx -u -c EmailFilters -a filterBehavior --filter_action drop`

### queryFilterBehavior

Queries the current filter behavior setting.

- **Additional flags:**
    - `--filter_action <string>` (optional, for checking specific state)
- **Example Usage:** `siteworx -u -c EmailFilters -a queryFilterBehavior`

---

## EmailSpamprefs controller

Manages SpamAssassin preferences for the SiteWorx account.

### edit

Edits basic SpamAssassin settings.

- **Additional flags:**
    - `--enable_spam <string>`: Enable SpamAssassin. Options: `1` (yes), `0` (no).
    - `--dropscore <string>`: Score at which emails are dropped/deleted (if enabled). Requires a numeric value.
    - `--spamscore <string>`: (`required_score`) Score at which emails are marked as spam. Numeric value.
    - `--rewrite_subject <string>`: (`rewrite_header subject`) Text to prepend to the subject of spam emails (e.g., `[SPAM]`). Provide the text as value.
    - `--report_safe <string>`: (`report_safe`) How to handle spam reports. Options: `0` (no change), `1` (attach spam as text), `2` (attach spam as message/rfc822).
- **Example Usage:** `siteworx -u -c EmailSpamprefs -a edit --enable_spam 1 --spamscore 5.0 --rewrite_subject "[SPAM]" --report_safe 1`

### addAdvanced / editAdvanced / deleteAdvanced

Manage advanced SpamAssassin configuration options (user\_prefs style).

- **addAdvanced Flags:**
    - `--type <string>`: Context of the preference. Options: `domain|email` (usually applies globally for SiteWorx account).
    - `--username1 <string>`: Often `@~newiwx.mattjung.net` or similar to indicate global for the account.
    - `--username2 <string>`: Typically empty.
    - `--preference <string>`: The SpamAssassin preference name (e.g., `blacklist_from`, `whitelist_to`, `required_score`).
    - `--value <string>`: The value for the preference.
- **addAdvanced Example:** `siteworx -u -c EmailSpamprefs -a addAdvanced --type domain --username1 "@~yourdomain.com" --preference whitelist_from --value trusted_sender@example.com`
- **editAdvanced / deleteAdvanced Flags:**
    - `--pref_id <string>`: The ID of the preference to edit/delete (obtainable from `listPreferences`).
    - (For `editAdvanced`, also include `--preference` and `--value` with new settings).
- **editAdvanced Example:** `siteworx -u -c EmailSpamprefs -a editAdvanced --pref_id 3 --value another_trusted@example.com`
- **deleteAdvanced Example:** `siteworx -u -c EmailSpamprefs -a deleteAdvanced --pref_id 3`

### listPreferences

Lists custom/advanced SpamAssassin preferences set for the account.

- **Example Usage:** `siteworx -u -c EmailSpamprefs -a listPreferences`

### listGlobalPreferences

Lists global SpamAssassin preferences (likely server-wide defaults).

- **Example Usage:** `siteworx -u -c EmailSpamprefs -a listGlobalPreferences`

### listSpamPreferenceIds

Lists IDs of spam preferences, useful for edit/delete operations.

- **Additional flags:**
    - `--datasource <string>`
    - `--format <string>`: Options: `both|values|display_values`.
- **Example Usage:** `siteworx -u -c EmailSpamprefs -a listSpamPreferenceIds`

### queryEdit / queryEditAdvanced

Queries current SpamAssassin settings for editing purposes.

- **queryEdit Example:** `siteworx -u -c EmailSpamprefs -a queryEdit`
- **queryEditAdvanced Example:** `siteworx -u -c EmailSpamprefs -a queryEditAdvanced --pref_id 3`

---

## EmailSpf controller

Manages Sender Policy Framework (SPF) records for domains. SPF records are TXT records in DNS used to prevent email spoofing.

### editAll

Edits the SPF record for a domain using a structured wizard-like approach.

- **Additional flags:**  
    
    - `--spf_record_value <string>`: Manually set the entire SPF string (e.g., “v=spf1 mx -all”). If used, other mechanism flags might be ignored.
    - `--spf_version <string>`: SPF version. Options: `v=spf1|v=spf3` (`v=spf1` is standard).
    - `--use_a <string>`: Allow servers listed in A/AAAA records for this domain. `1` (yes), `0` (no).
    - `--use_mx <string>`: Allow servers listed in MX records for this domain. `1` (yes), `0` (no).
    - `--use_ptr <string>`: Use PTR records for validation. NOT RECOMMENDED. `1` (yes), `0` (no).
    - `--other_servers <string>`: Authorize other hosts/IPs. `1` (yes, then use mechanism flags), `0` (no).
    - `--mechanism_a <string>`: Specify additional A/AAAA mechanisms (e.g., `a:otherdomain.com`).
    - `--mechanism_mx <string>`: Specify additional MX mechanisms (e.g., `mx:otherdomain.com`).
    - `--mechanism_ip4 <string>`: Specify IPv4 addresses/ranges (e.g., `ip4:192.0.2.0/24`).
    - `--mechanism_ip6 <string>`: Specify IPv6 addresses/ranges (e.g., `ip6:2001:db8::/32`).
    - `--mechanism_ptr <string>`: Specify PTR mechanisms (NOT RECOMMENDED).
    - `--mechanism_exists <string>`: Specify ‘exists’ mechanisms (e.g., `exists:%{ir}.%{l1r+}.spf.example.com`).
    - `--mechanism_include <string>`: Include SPF records from other domains (e.g., `include:_spf.google.com`).
    - `--all <string>`: Default policy for unmatched senders. Options: `-all` (fail), `~all` (softfail), `?all` (neutral), `+all` (pass – NOT RECOMMENDED).
    - `--redirect <string>`: Redirect to another domain’s SPF record (e.g., `redirect=example.com`). Overrides other mechanisms.
    - `--explanation <string>`: Custom explanation string (rarely used).
    - *A `--domain <string>` flag specifying which domain’s SPF record to edit is implicitly required.*
    
    `</li> <li><strong>Example Usage (for mydomain.com, allowing its own A/MX records and Google, softfail):</strong> <pre>siteworx --login_domain mydomain.com -u -c EmailSpf -a editAll --domain mydomain.com --use_a 1 --use_mx 1 --mechanism_include "include:_spf.google`
