diff --git a/snapcraft/explanation/interfaces.md b/snapcraft/explanation/interfaces.md index 6445c47..94bebd9 100644 --- a/snapcraft/explanation/interfaces.md +++ b/snapcraft/explanation/interfaces.md @@ -1,39 +1,17 @@ -By default, snaps with strict confinement are only able to access a limited set of resources outside the environment they run in. Snaps can only access resources from the system and other snaps via interfaces that describe the resources they provide. +An interface enables resources from one snap to be shared with another and with the system. By default, snaps with strict confinement are only able to access a limited set of resources outside the environment they run in. Snaps can only access resources from the system and other snaps via interfaces that describe the resources they provide. -The creator of a snap selects the interfaces that a snap requires in order to function correctly. Common interfaces include those that provide access to the [network](/t/the-network-interface/7880), [desktop features](/t/the-desktop-interfaces/2042) and the [sound system](/t/the-pulseaudio-interface/7906). +The creator of a snap selects the category of interfaces that a snap requires in order to function correctly. Common categories include [network](/t/the-network-interface/7880), [desktop](/t/the-desktop-interfaces/2042) and the [sound system](/t/the-pulseaudio-interface/7906). - -

Snap connections

+## View all the interfaces used by a snap -On the terminal, the _snap_ command provides more granular control over interface connections and which interfaces are operational on your system. - -The `snap connections` command lists which interfaces are connected and being used, while adding `--all` additionally shows interfaces with unconnected slots or plugs (shown in the output as a `-`): +Run the command: ```bash -$ snap connections --all -Interface Plug Slot Notes -adb-support scrcpy:adb-support :adb-support - -alsa ffmpeg:alsa :alsa manual -appstream-metadata snap-store:appstream-metadata :appstream-metadata - -iaudio-playback ardour:audio-playback :audio-playback - -dbus - cameractrls:dbus-daemon - -[...] +snap connections ``` -To see which interfaces a snap is using, and which interfaces it could use but isn't, type `snap connections `: +The `connections` command lists the interfaces a snap uses. For example, for the VLC snap you'd see: ```bash $ snap connections vlc -Interface Plug Slot Notes -audio-playback vlc:audio-playback :audio-playback - -audio-record vlc:audio-record - - -camera vlc:camera - - -desktop vlc:desktop :desktop - -home vlc:home :home - -(...) +Interface Plug Slot Notes +camera vlc:camera - - +desktop vlc:desktop :desktop - +desktop-legacy vlc:desktop-legacy :desktop-legacy - +home vlc:home :home - +mount-observe vlc:mount-observe - - +[...] ``` -In the above output, the [`camera`](/t/the-home-interface/7838) interface is not connected because its slot is empty. This means VLC cannot access any connected cameras. +In the previous example, you can see that the `vlc:camera` interface is disconnected because it has an empty *Slot* entry. -VLC can access the user's _/home_ directory because the [`home`](/t/the-home-interface/7838) interface is connected to the system `$HOME` directory (denoted by the `:home` slot name). +See [Interface management](/t/interface-management/6154) for further interface details, including how to disconnect interfaces and make manual connections, and [Security policy and sandboxing](https://forum.snapcraft.io/t/security-policy-and-sandboxing/554) for more information on how confinement is implemented. -To see all connected interfaces on your system, use the _snap connections_ command without a snap name: +To see all connected interfaces on your system, use the `snap connections` command without a snap name: ```bash $ snap connections @@ -101,7 +71,7 @@ audio-playback chromium:audio-playback :audio-playback - (...) ``` -Adding `--all` to the _snap connections_ command will list all interfaces, including those without a connection: +Adding `--all` to the `snap connections` command will list all interfaces, including those without a connection: ```bash $ snap connections --all @@ -113,7 +83,7 @@ alsa guvcview:alsa - - (...) ``` -

Auto-connections

+### Auto-connections Many interfaces are automatically connected when a snap is installed, and this ability is a property of either the interface itself, or the snap. @@ -129,7 +99,7 @@ For more technical details on how interface auto-connections are processed, see > ⓘ See the _Auto-connect_ column in the [Supported interfaces](/t/supported-interfaces/7744) table for which interfaces are connected automatically. -

Manual connections

+### Manual connections When you need to connect an interface manually, such as when you want to grant a snap access to [audio-record](/t/the-audio-record-interface/13090) for audio input, use the `snap connect` command: @@ -153,14 +123,13 @@ snap connect : : A slot and a plug can only be connected if they have the same interface name. -Add the `--no-wait` option to _snap connect_ or _snap disconnect_ to run the process in the background and return immediately to the command prompt. +Add the `--no-wait` option to `snap connect` or `snap disconnect` to run the process in the background and return immediately to the command prompt. [note type="positive"] A successful connection grants any necessary permissions that may be required by the interface to function. [/note] -

Disconnect interfaces

- +## Disconnect interfaces To disconnect an interface, use `snap disconnect`: @@ -174,8 +143,22 @@ Following our previous example, you would disconnect *vlc:audio-record* with the sudo snap disconnect vlc:audio-record ``` -

Forget manual disconnections

+### Forget manual disconnections When an automatic connection ([see above](#heading--auto-connections)) is manually disconnected, its disconnected state is retained after a [snap refresh](/t/managing-updates/7022). This state is even stored **after a snap has been removed**, including removal with the `--purge` option. The `--forget` flag can be added to the disconnect command to reset this behaviour, and consequently, re-enable the automatic re-connection after a snap refresh. + +## Control interfaces using a GUI + +The Ubuntu Software/[Snap Store](https://snapcraft.io/snap-store) desktop application is installed by default on Ubuntu and can be used to list an application's interfaces and to connect and disconnect them. + +An application first needs to be installed as a snap: + +![A screenshot of the Snap Store showing the VLC install page.](../media/GIMP-snap-install.png) + +To access the interface management functions, either search for an installed snap, or select it from the _Installed_ view. To view the interfaces for the selected application, select **Permissions**: + +![A screenshot of a Snap permissions dialogue.](../media/GIMP-interfaces.png) + +Each interface can now be connected or disconnected by selecting the toggle switch to the right of its description, and you may be prompted for your password. \ No newline at end of file diff --git a/snapcraft/media/GIMP-interfaces.png b/snapcraft/media/GIMP-interfaces.png new file mode 100644 index 0000000..a43975a Binary files /dev/null and b/snapcraft/media/GIMP-interfaces.png differ diff --git a/snapcraft/media/GIMP-snap-install.png b/snapcraft/media/GIMP-snap-install.png new file mode 100644 index 0000000..2de331a Binary files /dev/null and b/snapcraft/media/GIMP-snap-install.png differ