Config Commands

The config commands are used to configure the ownCloud server.

config
 config:app:delete      Delete an app config value
 config:app:get         Get an app config value
 config:app:set         Set an app config value
 config:import          Import a list of configuration settings
 config:list            List all configuration settings
 config:system:delete   Delete a system config value
 config:system:get      Get a system config value
 config:system:set      Set a system config value

Config App Commands

These commands manage the configurations of apps. Keys and values are stored in the database.

config:app:delete

sudo -u www-data php occ config:app:delete [options] [--] <app> <name>

Arguments

app

Name of the app.

name

Name of the config to delete.

Options

--error-if-not-exists

Checks whether the config exists before deleting it.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

Examples:

sudo -u www-data php occ config:app:delete myappname provisioning_api
Config value provisioning_api of app myappname deleted

The delete command will by default not complain if the configuration was not set before. If you want to be notified in that case, set the --error-if-not-exists flag.

sudo -u www-data php occ config:app:delete doesnotexist --error-if-not-exists
Config provisioning_api of app appname could not be deleted because it did not exist

config:app:get

sudo -u www-data php occ config:app:get [options] [--] <app> <name>

Arguments

app

Name of the app.

name

Name of the config to get.

Options

--default-value[=DEFAULT-VALUE]

If no default value is set and the config does not exist, the command will exit with 1.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

Examples

sudo -u www-data php occ config:app:get activity installed_version
2.2.1

config:app:set

sudo -u www-data php occ config:app:set [options] [--] <app> <name>

Arguments

app

Name of the app.

name

Name of the config to set.

Options

--value=[VALUE]

The new value of the config.

--update-only

Only updates the value. If it is not set before, it is not being added.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

Examples

sudo -u www-data php occ config:app:set \
   files_sharing \
   incoming_server2server_share_enabled \
   --value=true \
   --type=boolean
Config value incoming_server2server_share_enabled for app files_sharing set to yes

The config:app:set command creates the value, if it does not already exist. To update an existing value, set --update-only:

sudo -u www-data php occ config:app:set \
   doesnotexist \
   --value=true \
   --type=boolean \
   --update-only
Value not updated, as it has not been set before.

General Config Commands

These commands manage listing and importing configurations.

config:import

The exported content can also be imported again to allow the fast setup of similar instances. The import command will only add or update values. Values that exist in the current configuration, but not in the one that is being imported are left untouched.

sudo -u www-data php occ config:import filename.json

It is also possible to import remote files, by piping the input:

sudo -u www-data php occ config:import < local-backup.json
While it is possible to update/set/delete the versions and installation statuses of apps and ownCloud itself, it is not recommended to do this directly. Use the occ app:enable, occ app:disable and occ update commands instead.

config:list

The config:list command lists all configuration values for your ownCloud setup as well as for any apps.

sudo -u www-data php occ config:list [options] [--] [<app>]

Arguments

app

Name of the app. You can use "system" to get the config.php values, or "all" (the default) for all apps and system.

Options

--private

Use this option when you want to include sensitive configs, like passwords and salts.

By default, passwords and other sensitive data are omitted from the report so that the output can be posted publicly (e.g., as part of a bug report). You can see a sample output in the example below.

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
        ],
        "datadirectory": "\/var\/www\/localhost\/data",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbtype": "mysql",
        "version": "10.3.0.4",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "shareapi_allow_public_notification": "yes",
        "apps_paths": [
            {
                "path": "\/var\/www\/localhost\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/localhost\/apps-external",
                "url": "\/apps-external",
                "writable": true
            }
        ],
        "installed": true,
        "instanceid": "ocfp00rezy80",
        "loglevel": 2,
        "maintenance": false
    },
    "apps": {
        "backgroundjob": {
            "lastjob": "13"
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": "logging,dav"
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "enable_external_storage": "yes",
            "first_install_version": "10.3.0.2",
            "installedat": "1569845065.1792",
            "lastcron": "1571930489",
            "lastupdateResult": "[]",
            "lastupdatedat": "1572536814",
            "oc.integritycheck.checker": "{\"systemtags\":{\"EXCEPTION\":{\"class\":\"OC\\\\IntegrityCheck\\\\Exceptions\\\\MissingSignatureException\",\"message\":\"Signature data not found.\"}},\"comments\":{\"EXCEPTION\":{\"class\":\"OC\\\\IntegrityCheck\\\\Exceptions\\\\MissingSignatureException\",\"message\":\"Signature data not found.\"}}}",
            "public_files": "files_sharing\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "shareapi_allow_mail_notification": "yes",
            "umgmt_set_password": "false",
            "umgmt_show_backend": "true",
            "umgmt_show_email": "true",
            "umgmt_show_is_enabled": "true",
            "umgmt_show_last_login": "true",
            "umgmt_show_password": "false",
            "umgmt_show_quota": "true",
            "umgmt_show_storage_location": "false",
            "vendor": "owncloud"
        },
        "dav": {
            "enabled": "yes",
            "installed_version": "0.5.0",
            "types": "filesystem"
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "0.5.0",
            "types": "filesystem"
        },
        "federation": {
            "enabled": "yes",
            "installed_version": "0.1.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "1.5.2",
            "types": "filesystem"
        },
        "files_external": {
            "allow_user_mounting": "yes",
            "enabled": "yes",
            "installed_version": "0.7.1",
            "types": "filesystem",
            "user_mounting_backends": "googledrive,owncloud,sftp,smb,dav,\\OC\\Files\\Storage\\SFTP_Key,\\OC\\Files\\Storage\\SMB_OC"
        },
        "files_sharing": {
            "enabled": "yes",
            "installed_version": "0.12.0",
            "types": "filesystem"
        },
        "files_trashbin": {
            "enabled": "yes",
            "installed_version": "0.9.1",
            "types": "filesystem"
        },
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": "filesystem"
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "0.5.0",
            "types": "prevent_group_restriction"
        },
        "systemtags": {
            "enabled": "yes",
            "installed_version": "0.3.0",
            "types": "logging"
        },
        "updatenotification": {
            "enabled": "yes",
            "installed_version": "0.2.1",
            "types": ""
        }
    }
}

Displaying Sensitive Information

To generate a full report which includes sensitive values, such as passwords and salts, use the --private option, as in the following example.

sudo -u www-data php occ config:list --private

Filtering Information Reported

The output can be filtered to just the core information, core and apps, or one specific app. In the example below, you can see how to filter for each of these categories.

# List only system configuration details
sudo -u www-data php occ config:list -- system

# List system and app configuration details
# This is the default, so doesn't need to be explicitly specified
sudo -u www-data php occ config:list -- all

# List configuration details of the dav app
sudo -u www-data php occ config:list -- dav

Below is an example of listing the config details for a single app.

{
    "apps": {
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": "filesystem"
        }
    }
}

Config System Commands

These commands manage system configurations.

config:system:delete

sudo -u www-data php occ config:system:delete [options] [--] <name> (<name>)...

Arguments

name

Name of the config to delete, specify multiple for array parameter.

Options

--error-if-not-exists

Checks whether the config exists before deleting it.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

Examples:

sudo -u www-data php occ config:system:delete maintenance:mode
System config value maintenance:mode deleted

config:system:get

sudo -u www-data php occ config:system:get [options] [--] <name> (<name>)...

Arguments

name

Name of the config to get. Specify multiple for array parameter.

Options

--default-value[=DEFAULT-VALUE]

If no default value is set and the config does not exist, the command will exit with 1.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

Examples:

sudo -u www-data php occ config:system:get version
10.7.0.4

config:system:set

sudo -u www-data php occ config:system:set [options] [--] <name> (<name>)...

Arguments

name

Name of the config parameter, specify multiple for array parameter.

Options

--type=[TYPE]

Value type to use (string, integer, double, boolean, json, default is string).
Note: you must use json to write multi array values.

--value=[VALUE]

The new value of the config.

--update-only

Only updates the value. If it is not set before, it is not being added.

--output=[OUTPUT]

The output format to use (plain, json or json_pretty, default is plain).

In order to write a boolean, float, JSON, or integer value to the configuration file, you need to specify the type of your command. This applies only to the config:system:set command. See table above for available types.

Examples

Disable the maintenance mode:

sudo -u www-data php occ config:system:set maintenance \
   --value=false \
   --type=boolean

ownCloud is in maintenance mode - no app have been loaded
System config value maintenance set to boolean false

Create the app_paths config setting (using a JSON payload because of multi array values):

sudo -u www-data php occ config:system:set apps_paths \
      --type=json \
      --value='[
        {
            "path":"/var/www/owncloud/apps",
            "url":"/apps",
            "writable": false
        },
        {
            "path":"/var/www/owncloud/apps-external",
            "url":"/apps-external",
            "writable": true
        }
    ]'

Adding Redis to the configuration:

sudo -u www-data php occ config:system:set \
   redis \
   --value '{"host": "127.0.0.1", "port": "6379"}' \
   --type json

System config value redis set to json {"host": "127.0.0.1", "port": "6379"}

Some configurations (e.g., the trusted domain setting) are an array of data. The array starts counting with 0. In order to set (and also get) the value of one key, you can specify multiple config names separated by spaces:

sudo -u www-data php occ config:system:get trusted_domains
localhost
owncloud.local
sample.tld

To replace sample.tld with example.com trusted_domains ⇒ 2 needs to be set:

sudo -u www-data php occ config:system:set trusted_domains 2 --value=example.com
System config value trusted_domains => 2 set to string example.com

sudo -u www-data php occ config:system:get trusted_domains
localhost
owncloud.local
example.com