45

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,212
  • 2
  • 10
  • 26

3 Answers3

62

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
  • 853
  • 7
  • 19
  • 1
    Changing permissions might also reset all the preferences, at least this is what happened with Thunderbird. All the account settings were done, but, at least, now I can drag/drop files to attach them to messages! – Cosmin Saveanu Nov 13 '20 at 11:09
  • 2
    Because this tool downloads more than 200 megabytes of data in my case, it is possibly better to use other methods that does not require any further data installed. – 16851556 Mar 22 '22 at 15:05
57

You can do this via the command line. The specific command you need is (it may need to be run with sudo):

flatpak override <package_name_here> --filesystem=<path_here>

If you have an odd path & it complains about an "unexpected filesystem suffix", just put the path part in quotes.

If you wish to remove access to a particular address, use "--nofilesystem":

flatpak override <package_name_here> --nofilesystem=<path_here>

A more complete list of permissions/commands is found here.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
Pockets
  • 948
  • 8
  • 13
  • Thanks, I can add Dropbox folder to the WPS Office path – Indacochea Wachín Apr 19 '19 at 14:35
  • I did this with `--filesystem=/home/myuser` and it worked. I then tried with `/` to beeing able to access my shares at `/mnt` and from now on, when I try to start the app I get `wrap: Can't create file at /run/user/1000/bus: No such device or address`. My app is `Flacon` (I need it for splitting a large `flac` file`). – bomben Jul 12 '21 at 15:24
  • Found a solution - `flatpak override --nofilesystem=`. So for you, do `flatpak override com.github.Flacon --nofilesystem=/`. – Pockets Jul 13 '21 at 17:49
  • 1
    Note that, according to [the official docs](https://docs.flatpak.org/en/latest/sandbox-permissions.html), these directories are blacklisted: `/lib`, `/lib32`, `/lib64`, `/bin`, `/sbin`, `/usr`, `/boot`, `/root`, `/tmp`, `/etc`, `/app`, `/run`, `/proc`, `/sys`, `/dev`, `/var`, meaning you can't give an app access to them even using the override method. – Dane Rossenrode Aug 14 '21 at 07:44
  • 1
    What's missing from this answer is a way to check the current filesystem permissions. I couldn't find it in the linked documentation. – andrybak Feb 12 '22 at 11:47
  • 1
    `$ flatpak list` to get the package name. – Johnny Baloney Dec 23 '22 at 16:33
8

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
  • 441
  • 4
  • 14
  • This was the only thing that worked for me for PPSSPP flatpak not being able to access $USER/.var/app/org.ppsspp.PPSSPP (which was a symlinked folder, but both the base folder and symlinked folder had correct permissions). – ipkpjersi May 01 '22 at 18:49