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.
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 ]’
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.
Last updated 3 months ago. Help improve this document in the forum.