Interfaces for users
interfaces · for users for users
How a snap's connections look from the command line, what snap connect and snap disconnect do, and how snapd remembers an automatic connection you removed.
On the map: the travellers' ward, inside the gatehouse
01 Seeing the connections
snap connections photo-editor lists each plug, its slot and a note. A dash as the slot means not connected; manual means you connected it. An unconnected plug shows up inside the app only as an error.
You've installed the photo editor, and you'd like to know what it can reach. snap connections, with the snap's name, lists every plug it has: the interface, the plug, the slot it's connected to, and a note. A slot that starts with a colon belongs to the system. A dash in the slot column means not connected. Here that's the camera and removable-media. Home and network connected by themselves at install, so their note is a dash too. Connect something by hand and the note says manual. The app can't see any of this; it just gets an error, such as permission denied.
02 Connecting and disconnecting
sudo snap connect photo-editor:camera connects the plug to the system's camera slot; snap disconnect photo-editor:camera removes it. Both act on the whole snap and show up in snap changes.
Now you'd like to take a picture with the webcam. Snap connect, naming the photo editor's camera plug, does it. You don't have to name a slot: snapd picks the system's only camera slot. Changing permissions needs root, so use sudo, or polkit asks for your password. The connection belongs to the whole snap, so every app in it that uses the camera plug gets the camera. Done with it? Snap disconnect, with the same plug, takes it away again. Both run as changes, so snap changes lists them afterwards.
03 What snapd remembers
Disconnecting an automatic connection is remembered across refreshes, so it stays disconnected. snap disconnect --forget drops that memory, and auto-connection may connect the plug again.
A week later you decide the photo editor shouldn't have the network. Snap disconnect removes it. But network connected by itself at install, so what stops the next refresh from connecting it again? snapd keeps that connection on record, marked as one you didn't want, and auto-connect skips it. A connection you made by hand is simply forgotten when you disconnect it. Changed your mind? Snap connect brings it back. And snap disconnect --forget drops the record too, so the next refresh connects the plug by itself again.
04 Where to go from here
Roads: home and network, AppArmor prompting, the interface families, the overlord, and the developers' deck.
Listing, connecting, disconnecting, and one thing snapd remembers. Here's where to go next. Home and network are the two interfaces you'll meet most, and each has a deck. If home feels like all or nothing, AppArmor prompting asks you before the app opens a file. The interface families list every interface and what it lets a snap do. The overlord explains the changes that snap changes shows. And the developers' deck shows how the plugs got there in the first place.
Read more
Commands
| Command | Effect |
|---|---|
snap connections | connected plugs and slots of all snaps |
snap connections --all | also the unconnected ones |
snap connections <snap> | every plug and slot of that snap, connected or not |
snap interface <interface> | what the interface is for, and which snaps have plugs and slots of it |
snap connect <snap>:<plug> | connect to the one system slot of the plug's interface; fails if there are several |
snap connect <snap>:<plug> <snap> | connect to the one slot of that interface on the other snap |
snap connect <snap>:<plug> <snap>:<slot> | connect to that slot |
snap disconnect <snap>:<plug> | disconnect everything from that plug |
snap disconnect <snap>:<plug> <snap>:<slot> | disconnect that one connection |
snap disconnect --forget <snap>:<plug> | also drop the record that keeps an automatic connection from returning |
snap connect and snap disconnect need root, a user logged in with snap login, or polkit authorisation (io.snapcraft.snapd.manage-interfaces). Listing needs nothing.
Reading snap connections
| Column | Meaning |
|---|---|
| Interface | the interface name; for content, the content tag follows in brackets |
| Plug | <snap>:<plug>, or - for an unconnected slot |
| Slot | <snap>:<slot>; :<slot> for the system; - if the plug is not connected |
| Notes | manual if you connected it, gadget if the device's gadget did, - otherwise |
What is remembered
| You disconnect | Afterwards |
|---|---|
| an automatic connection | it stays disconnected across refreshes; snap connect brings it back |
| a connection you made | forgotten; nothing reconnects it |
either, with --forget | forgotten; an automatic connection may return at the next refresh |
Further reading
- Connect interfaces: listing, connecting, disconnecting and forgetting, with examples.
- All about interfaces: what plugs and slots are.
- Supported interfaces: every interface, with whether it auto-connects.
- Get started: connecting an interface as part of a first session with snaps.
Roads from here
INTERFACES AND CONFINEMENT
- Interfaces — back to the interfaces overview
- The home interface — the interface most users meet first
- The network interface — the other interface every desktop snap has
- Interfaces for snap developers — how the plugs got there
- How interfaces are implemented — what happens underneath
RUNNING SNAPS
- The overlord — the changes that snap changes lists
INTERFACE FAMILIES · every interface, grouped by what it touches
- "Interfaces: files, data and snapd's own API" — the family with home and removable-media
- "Interfaces: devices and storage" — the family with camera
DESKTOP · snaps in a user session
- AppArmor prompting — being asked before an app opens a file