§2024-05-03
Certain snaps, such as those providing a background service, expose configuration options that can be viewed and changed.
The commands for viewing and changing these configuration options are snap get, snap set and snap unset.
For example, to see the configuration options exposed by an installed snap, enter snap get
$ sudo snap get nextcloud
Key Value
mode production
nextcloud {...}
php {...}
ports {...}
private {...}
The {...} in the output indicates that there are further options beneath the current key name level.
:information_source: If there are no configuration options, you will see error: snap
has no configuration.
$ sudo snap get vls
error: snap "vls" has no configuration
- To explore configuration options, append the key name to the get command:
$ sudo snap get nextcloud ports
Key Value
ports.http 45101
ports.https 443
$ sudo snap get -d nextcloud
{
"http": {
"compression": false,
"notify-push-reverse-proxy": false
},
"mode": "production",
"nextcloud": {
"cron-interval": "5m"
},
"php": {
"memory-limit": "512M"
},
"ports": {
"http": 45101,
"https": 443
},
"private": {
"http": {
"compression": false,
"notify-push-reverse-proxy": false
},
"mode": "production",
"nextcloud": {
"cron-interval": "5m"
},
"php": {
"memory-limit": "512M"
},
"ports": {
"http": 45101,
"https": 443
},
"snap": {
"version": "27.1.8snap1"
}
}
}
- to change port of nextcloud
alexlai@hc4Noble:~$ sudo snap stop nextcloud
alexlai@hc4Noble:~$ sudo snap set nextcloud ports.https=45103
alexlai@hc4Noble:~$ sudo snap get nextcloud ports
Key Value
ports.http 45101
ports.https 45103
alexlai@hc4Noble:~$ sudo snap restart nextcloud