mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #4588] Allow access to some specific file/folder while program is running inside firejail #2715
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2715
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danielkrajnik on GitHub (Oct 5, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4588
Is there an easy way to allow a program (firefox) to access specific file/folder while it is running?
@SkewedZeppelin commented on GitHub (Oct 5, 2021):
No.
Once created it cannot be granted access to other directories.
You can however push a file into it via get/put.
@danielkrajnik commented on GitHub (Oct 5, 2021):
That sounds like the right way to do it - could you please let me know how to do it/where to find documentation/information about this method?
EDIT: get/put as in HTTP get/put? Not sure what you meant...
@SkewedZeppelin commented on GitHub (Oct 5, 2021):
man firejail@danielkrajnik commented on GitHub (Oct 5, 2021):
I see, thanks a lot. does it work with clipboard, as well? Just noticed that firejail also blocks (I think) pasting images to outlook (web app).
EDIT: I've deleted the previous comment out of shame, but SkewedZeppelin replied already, so the question was how to specify a running process...
@SkewedZeppelin commented on GitHub (Oct 5, 2021):
You use
firejail --listfind the process you want to put a file into, note the process ID number and pass it using --name=[the process number]clipboard should work just fine.
@danielkrajnik commented on GitHub (Oct 5, 2021):
thanks again, good to know that firejail does not or cannot block clipboard. that problem must have been with outlook then
@danielkrajnik commented on GitHub (Oct 5, 2021):
On google-chrome it errors with:
Warning: cannot open destination file /home/user1/Downloads, file not copiedEDIT: this worked:
firejail --put=307114 /home/user1/Desktop/renderdoc_1.15.tar.gz renderdoc_1.15.tar.gzEDIT2: removed "easy" from the name of this issue
@rusty-snake commented on GitHub (Jun 8, 2022):
Can we close here?
@Danny3 commented on GitHub (Jun 19, 2025):
I would prefer if you don't, at least until proper solution is found.
My use case is like this:
I just learned how to start games with Proton from the command line, but I don't want them to access my home partition, at all.
So I'm starting them like this:
All good and OpenSnitch application firewall doesn't detect any internet connection atttempt!
The problem is that some of the games have the ability to play some music from you computer, which is very nice compared to the one that the games already have.
That way you can even have your favorite songs or the songs in your native language, which is awesome.
The problem is that if I copy the music folder into Proton (WINE)'s prefix, I will waste a lot of space, which will remain less for the games and other things, it's it's a big waste of space. Updating the music folder is also a pain as I have to delete and copy the folder again to have the latest changes.
Not running the games each with each own prefix instead of one for all or not running them with FireJail is also a No-Go!
So for my use case, the best solution would be to have another parameter for Firejail, where I specify a read-only path, let's say:
Or:
Flatpak gives you the ability to share with its sandbox a folder in read-only mode, so why wouldn't FireJail be able to do the same?
I think this would be a very nice and helpful addition for my use case and probably for others too.
In my opinion a shared folder in read+write mode should be added too.
Like for example somebody wanting to sandbox a file downloader / sharing program, which must be able to write and read from a folder somewhere, but leave every other folder or file on the system untouched.
@rusty-snake commented on GitHub (Jun 19, 2025):
@kmk3 commented on GitHub (Jun 20, 2025):
Whitelisting is incompatible with
--private.It should work when using a whitelisting profile (such as steam.profile) and
whitelist+read-only.Example:
As @rusty-snake said, this already exists and is unrelated to the issue, so if
the above does not work, open a new bug report:
@Danny3 commented on GitHub (Jun 28, 2025):
I'm sorry, but I do not understand what is already supported?
I already read as much as I could about configuring FireJail from various sources and that's how I came up with that long line of arguments to make sure a game doesn't access my home folder or the internet, but I haven't seen how to make an exception for a folder and with searching I found this issue, which confirms that it's indeed not possible.
What does already exists, the whitelisting?
Since it's not working with '--private', it's useless from what what I want to achieve.
As I definitely want to use '--private' to forbid any changes to /root and /home/user.
And I also don't want to use an already made profile, which I don't trust to have been made with the same level and principles of privacy and security that I want and I would also lose time to read the configuration of each profile.
Plus, I don't want to sandbox Steam, which is already using Flatpak and I think BubleWrap too.
I want to use my own arguments for all the games that I start directly with Proton (outside of Steam).
Anyway, for this case where the games can playback some music files and I don't want to copy all the music in its music folder, I found 2 solutions, that seems to work when the game is started with FireJail:
sudo mount --bind -r ~/Music .
Verify it with:
sudo mount | grep Music
And finally after the game is closed and FireJail exits, remove the mount with:
sudo umount .
For the second solution I got the inspiration from this answer:
https://askubuntu.com/a/896959
Unfortunately this requires superuser privileges and I'm not too happy about it, so I think I will try the symlink to another drive solution until FireJail will give us a way to share a folder with the sandbox even when using the '--private' argument.
Anyway, maybe I'm asking too much to forbid all access to the home partition and then also allow access to a folder from it.
So, I will not open another bug report about it.
Thanks for being nice and understanding!
@rusty-snake commented on GitHub (Jun 28, 2025):
Sharing only a subset (e.g. one folder) of
$HOME.This issues is about allowing access to a folder after the sandbox was started.
Well, if you say you're requirement is "use '--private' to forbid any changes to /root and /home/user" rather then "forbid any changes to /root and /home/user" (i.e. you're requirement already contains part of the solution) this is hard to solve.