The personal-files interface

personal-files provides access to the specified files in the user’s home. This interface gives privileged access to the user’s data.

Auto-connect: no
Attributes:

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

Transitional: no

Requires snapd version 2.37+.

This interface is typically used to provide read-only access to top-level hidden data directories within a user’s home directory in order to support importing data from existing applications where the snap is the clear owner of the target directory.

For distribution via the Snap store, consumers of this interface will need make an approved snap declaration. For acceptance, you will need to make a descriptive interface reference, as used by snap connections|interfaces|connect|disconnect commands.

For example, if a foo application is being packaged as a snap and its publisher wants the snap to import an existing configuration from ~/.config/foo, the snapcraft.yaml could include the following:

name: foo
...
plugs:
  config-foo:
    interface: personal-files
    read:
    - $HOME/.config/foo

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

With the above built snap, you would then be able to use the following to enable access to personal files:

$ 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 27 days ago. Help improve this document in the forum.