I have just upgraded to a recent version of Ubuntu that uses snap apps, and I have trouble understanding how I’m supposed to use them to work with files outside of
/home. I have three disks in my machine, a large photo library on
sdb, backup drives, and other things. As snap apps are confined, they cannot access any of them.
Only solution I can think of, is to bind mount everything to some folder under
/home, but that seems like a terrible thing to do every single time I want to look at a file. Searching the web brings up blog posts about "snap interfaces" and "snap connections", but it is unclear to me if that could be helpful.
So the question is: What is the intended method for using snap apps to work with files stored outside of
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
what is the intended method for using snap apps to work with files stored outside of /home?
The snap should be designed to do that under confinement by making use of the
removable-media interface. Connecting such an interface will grant confined access to drives mounted in
/media as well as
To see if the snap in question supports this, run
snap connections <snap name>. For example, for Nextcloud:
$ snap connections nextcloud Interface Plug Slot Notes network nextcloud:network :network - network-bind nextcloud:network-bind :network-bind - removable-media nextcloud:removable-media - -
nextcloud:removable-media has no associated slot, that means the interface is not connect, thus Nextcloud cannot access removable media. To connect it, we can run
sudo snap connect nextcloud:removable-media. Then the connections look like the following:
$ snap connections nextcloud Interface Plug Slot Notes network nextcloud:network :network - network-bind nextcloud:network-bind :network-bind - removable-media nextcloud:removable-media :removable-media manual
Now that the plug is connected to a slot, Nextcloud now has confined access to removable media in
/mnt. Other applications will work the same way if the developer built such functionality in. If they didn’t, log a bug! You can find where to log a bug with
snap info <snap name>, for example:
$ snap info nextcloud <snip> contact: https://github.com/nextcloud/nextcloud-snap <snip>
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂