The system-files interface

system-files provides access to the specified files in the system that are available in the snap’s runtime environment (eg, files in /etc). This interface gives privileged access to system data.

Auto-connect: no
Attributes:

  • read (plug): list of files and/or directories for read-only access (eg, ‘read: [ /etc/file-read, /etc/dir-read ]
  • write (plug): list of files and/or directories for read/write access (eg, ‘write: [ /etc/file-write, /etc/dir-write ]

Transitional: no

Requires snapd version 2.37+. This interface is typically used for providing read-only access to system configuration directories to snaps that are the clear owner of the directory in order to support importing from existing applications. Importantly, this interface should not be used as a means to give access to system files where the snap is not the clear owner (eg, /dev, /proc, /sys, /usr, etc). Consumers of this interface require a snap declaration for distribution via the Snap Store.

An additional requirement for acceptance in the Global store is using a descriptive interface reference for use with snap connections|interfaces|connect|disconnect. For example, the ‘foo’ application is packaged as a snap and the snap publisher wants to import existing configuration from /etc/foo into the snap. The snapcraft.yaml might be:

name: foo
...
plugs:
  config-foo:
    interface: system-files
    read:
    - /etc/foo

apps:
  foo:
    plugs:
    - config-foo
    ...

With the above, a snap connect command would look like: snap connect foo:config-foo.

This is a snap interface. See Interface management and Supported interfaces for further details on how interfaces are used.

Last updated 3 months ago. Help improve this document in the forum.