Accessing /tmp from snaps?

I often use /tmp to save files I don’t need to keep or to transfer them between applications.

But it seems with snaps this doesn’t work, is there any way to access /tmp?
File dialogs show the contents of /tmp from such applications but I can’t seem to read or write any files in them.

I’m asking this both as a snap developer (where I might create a file in /tmp from a snap to be opened by applications outside the snap) and as a user (where I might create a file in /tmp and want to open it from a snap).

snaps use a per-app /tmp, there is no way to access the hosts /tmp directory easily to prevent snaps from stealing data of other running applications …

but what if an app needs to open a temporaty file with another app?

Then it should put temporary files somewhere else than /tmp . For example firefox uses ~/Downloads which may not be a perfect choice but shows the way.

Quick clarification: this is correct inasmuch as it relates to accessing the system’s /tmp and sharing access to the same space between snaps, but the /tmp that a given snap application can see is specific to the given snap, not the application. This is an important distinction, as snaps can include multiple applications. If each of those applications saw a different /tmp, they wouldn’t be able to share things between them. Thankfully that’s not the case-- every app within the same snap sees the same /tmp, so it’s possible to e.g. proxy to the PHP app’s unix socket in /tmp/sockets from the Apache app.

1 Like

What is the best chance then ?

Just a 0,02€ bet

sudo   mount   --bind   /something   /home/user/snap/somewhere

Roughly as in GiMP and thumbnails for .xcf files


You may set TMPDIR variable to redirect saving of files from /tmp to somewhere else. Not all apps respect it but most do.


We are in 2023, we use Ubuntu 22.04.x, Thunderbird for email and would like to use Okular (from snap) but is not possible to open a pdf file directly. (save as first and open the pdf after is not a solution)

We got a /tmp error… I read many threads with this kind of problem. So what is the solution? I mean something pro out the box, not mounting stuff or whatever…

So this thread are 2 years old… but same problem in 2023. What is the solution?


1 Like

did you file a bug against thunderbird ? seems it is not using xdg portals properly (or your desktop does not have them installed)

Hi, this is what i got in syslog when i try to open file direcly from Thunderbird (permission problem):

thunderbird.desktop[26420]: /usr/bin/env: «/tmp/pid-25297/test-file.pdf»: Permission non accordée

xdg stuffs are installed on my computer. No i didn’t fill bug in Thunderbird because i read everywhere that is a snap problem with sandboxing tmp folder. Snap can’t read the /tmp folder. Right?

well, see above, snaps all have their own /tmp folder so nothing can spy on data stored there, but the xdg portals are existing for exactly that use case and it seems thunderbird does either not use them at all or uses them wrongly.

Quick question - is that per-app /tmp in memory file system or some real location?

It’s a real location-- a subdirectory of the host’s /tmp.

1 Like

Thank you, searched under /tmp and found it.

… and for completeness … if /tmp is a tmpfs your snaps /tmp’s will then indeed live in ram too :wink:

1 Like