I'm building a snap package and my application requires a configuration file that normally is placed under /etc and has to be editable by essentially root user only.

I've figured out that I can easily refer to configuration files within a snap's confinement by using, for example, $SNAP/myconfig. However, that makes myconfig read-only.

So, how do I place a configuration file into $SNAP_DATA or its equivalent? I guess such file has to be exposed to a system (in snappy parlance) and writeable by system users (root).

2 Answers 2


What I'm generally doing is having the software reading multiple files:

  • user configuration
  • global configuration
  • default configuration

Each keys (like if it's yaml or json, or just key-value pair) that are upper on the stack overrides the ones below.

That way, you can ship your default configuration in $SNAP, if the user set a global configuration, he can tweak (or copy) in $SNAP_DATA with the same file name. and same at user's level with $SNAP_USER_DATA`.

Note that you can ship a configuration app as part of your snap to scaffold your configuration files.

  • Well, this particular application doesn't do that and it's not up to me to modify it so that it does what you suggest. Besides, I find it very odd that snap packages put forth so many requirements that basically boil down to "you must change your applications to conform to our requirements". I already like APT/deb a lot more over snap because it plays along nicely with just about any software out there. Anyway, the application I'm packaging can be configured to use a configuration file with a typical -c option but is installing a user-editable configuration file not possible?
    – ILIV
    Jul 4, 2016 at 8:59

There is a writable directory for your snap, that the snap can read and write files in. I would suggest you make an etc/ subdirectory of that for this config file. It may be necessary to provide a wrapper that invokes the editor and gives it access to that file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .