accessing files outside of /home in snap apps
Solution 1:
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 /mnt
.
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 - -
Since 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 /media/
and /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>