67

I installed Elisa music player from Flathub, but it refuses to see my Music partition, so I can't add any music to it's library unless I copy it to /home/my_user/.

Is there a way to give a Flatpak application permission to access non canonical addresses?

Aside from specifying it when compiling it...

eridani
  • 1,584

4 Answers4

88

To add to the other answer, another solution that worked for me was installing Flatseal. It makes setting permissions super easy and also has the added benefit of making the existing permissions really clear. Here's what adding a directory to steam looks like in Flatseal:

Adding extra directory to steam in Flatseal

I added the directory "MediaSSD" there, everything else is default.

Hassan
  • 1,113
81

This can be done via the command line. All the below commands will likely need to be run as root.

Granting Access

The specific command to grant permission to a particular path/folder is:

flatpak override <Application ID> --filesystem=<path_here>

To find the Application ID, as Johnny Baloney notes in the comments, use "flatpak list" (you'll probably want to combine with grep):

flatpak list | grep <part of program name (e.g. "elisa")>

The Application ID will look something like "org.kde.elisa".

If you have an odd path and get back an error about an "unexpected filesystem suffix", try putting the path in quotes:

flatpak override <Application ID> --filesystem="<unusual_path_here>"

You can also grant read-only access by appending ":ro" at the end of the path:

--filesystem=<path_here>:ro

Exceptions/limitations on what filesystem access can be granted are noted in the docs under Reserved Paths (see Dane Rossenrode's comment below for a quick reference).

Removing/Prevent Access

If you wish to block access to a particular path, use "--nofilesystem":

flatpak override <Application ID> --nofilesystem=<path_here>

Or you may use the "--reset" command to return ALL permissions to default (Warning! If you do not supply an Application ID with this command, permissions will be reset on ALL installed Flatpaks!):

flatpak override --reset <Application ID>

Other

Use "--show" to display edited permissions (including filesystem access):

flatpak override --show <Application ID>

and use "info --show-permissions" to list all permissions:

flatpak info --show-permissions <Application ID>

A more complete list of permissions/commands is found in the documentation for sandbox permissions and Flatpak commands.

Pockets
  • 1,213
10

Run once to allow access to normal files on the host, not including host OS or system internals:

sudo flatpak override ApplicationIDHere --filesystem=host

ApplicationID is shown using command: sudo flatpak list

Then:

flatpak run ApplicationIDHere
16851556
  • 677
0

To add to this answer, which is similar to what Hassan said. I tried installing WhatsApp Web as a PWA. I needed to add these lines into Flatseal in order for Chrome being able to create a shortcut with a matching icon:

~/.local/share/applications

~/.local/share/icons

Remember to restart Chrome for the changes to take effect

Flatseal Chrome - File system - Other files - Entries

HotFix
  • 101
  • 1