Files and folders¶
An app sees only its own files and a private home. Nothing of yours is visible to it unless you grant it; how this is built, and why, is explained in the filesystem view.
Where the app's own files are¶
Each app has a private home that it sees as /home/app. On your side it is
~/.local/share/appjail/apps/NAME/home. Settings, caches and anything the app saves "in its home" land there and are
kept between runs. appjail reset NAME empties it and keeps the app; appjail remove NAME deletes it with the app.
Both ask first, and both refuse while the app runs.
To give an app a file, you can copy it into that folder; the ways below avoid copies.
A folder, every time¶
appjail perms NAME --add-dir ~/Documents/notes # read-only
appjail perms NAME --add-dir ~/Documents/notes:rw # read-write
appjail perms NAME --rm-dir ~/Documents/notes # take it back
A folder in your home appears at the same place under the app's home: ~/Documents/notes becomes
/home/app/Documents/notes. A folder outside your home, such as /srv/media, appears at the same path.
A folder or a file, once¶
appjail run NAME --dir ~/Downloads # this run only, read-only unless :rw
appjail run NAME --file ~/report.pdf # this file only; its path in the jail is passed to the app
--file makes only that file visible, not the rest of its folder. Opening a file from the app's menu entry does the
same, read-only unless the entry was created with --rw.
Two details of --file:
- An app that saves by writing a new file and renaming it over the old one cannot save to a file granted with
:rw(a bound file can be rewritten, not replaced). Grant its folder instead. - A file whose own name ends in
:rwor:roneeds its mode written out:run NAME --file 'x:rw:ro'grants the filex:rw, read-only.
What cannot be granted¶
These are refused in every mode, with a message:
- credentials and secrets:
~/.ssh,~/.gnupg, cloud, container and package-registry credentials, password stores, browser profiles, mail, shell histories, files named like keys or password databases, and any folder above one of these locations (appjail checks paths; it does not search a folder you grant for key files kept elsewhere in it); - your whole home, any folder above it,
/, the broad~/.config,~/.localand~/.cache, and system trees such as/etc,/usror/dev; /tmp,/var/tmpand anything below them (other programs' sockets live there; a single regular file there can still be opened with--file);- appjail's own data and configuration.
These are refused read-write only, because something outside the jail would later run or decode what the app writes
there: ~/.local/bin, ~/.local/lib, autostart and systemd user folders, menu entries, icon themes, thumbnailers,
file-manager scripts, cargo's ~/.cargo/bin, and shell, editor and tmux startup files (and any folder that holds
one, such as ~/.config/git); and the toolkit settings, themes and fonts your other apps use
(~/.config/gtk-3.0, ~/.config/gtk-4.0, ~/.config/kdeglobals, ~/.local/share/themes, ~/.local/share/fonts,
~/.config/fontconfig, ...), where a written file would change how they look.
There is no override. Grant a narrower folder: ~/.config/someapp instead of ~/.config, ~/Projects/site instead of
~/Projects if ~/Projects holds a key.
Removable media (USB drives, SD cards)¶
Where a drive appears depends on how your distribution builds udisks, the service that mounts removable media when you plug them in:
| Distribution | A drive labelled PHOTOS appears at |
|---|---|
| Debian, Ubuntu | /media/USER/PHOTOS |
| Fedora and others that keep udisks' default | /run/media/USER/PHOTOS |
Grant the drive itself, as any folder: appjail perms NAME --add-dir /run/media/USER/PHOTOS, or run --file for a
single file on it. Grant the drive, not /media or /run/media/USER, which would show the app every drive you plug in
(/run/media/USER is refused; /media/USER is a folder like any other, so mind what you grant).
Why /run is refused otherwise. /run holds the runtime state of the whole system and of every logged-in user:
under /run/user/UID are your session bus, your Wayland socket, your audio server, your keyring and the sockets of your
agents. A grant of anything there would put those within reach, so appjail refuses /run as a whole, for folders and
for single files alike, rather than judging which parts of it are harmless. The one exception is a mount point below
your own /run/media/USER, or a path inside one: nothing but drives is mounted there, and the name has to be yours (the
account running the app), so another user's drive is refused. A manifest does not know whose name that will be, so
perms accepts any name there and run refuses a drive that is not yours.
Alternatives¶
- The portal file chooser (
--allow portals) lets the app ask you for a file in a dialog it does not control; it gets the file you pick and nothing else, for as long as you do not revoke it (appjail portals NAME). - Copying a file into the app's home is the simplest and keeps your original out of reach.