[GH-ISSUE #961] Whitelisting folder? #653

Closed
opened 2026-05-05 06:21:43 -06:00 by gitea-mirror · 11 comments
Owner

Originally created by @peterzhu2118 on GitHub (Dec 6, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/961

How do I whitelist a folder under /root? Right now I added whitelist /root/temp to the profile file but if I do firejail ls /root/temp it says the folder doesn't exist. I want to disable everything else (other folders).

Originally created by @peterzhu2118 on GitHub (Dec 6, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/961 How do I whitelist a folder under `/root`? Right now I added `whitelist /root/temp` to the profile file but if I do `firejail ls /root/temp` it says the folder doesn't exist. I want to disable everything else (other folders).
gitea-mirror 2026-05-05 06:21:43 -06:00
Author
Owner

@netblue30 commented on GitHub (Dec 8, 2016):

I'll add support for it, currently only user home, /dev, /media, /mnt, /opt, /srv, /var, and /tmp are supported by whitelist.

<!-- gh-comment-id:265750906 --> @netblue30 commented on GitHub (Dec 8, 2016): I'll add support for it, currently only user home, /dev, /media, /mnt, /opt, /srv, /var, and /tmp are supported by whitelist.
Author
Owner

@peterzhu2118 commented on GitHub (Dec 8, 2016):

@netblue30 But my home folder is /root. If I do echo $HOME I get /root. But the whitelisting doesn't allow the program to read the files inside that folder (program says file is not found).

<!-- gh-comment-id:265850932 --> @peterzhu2118 commented on GitHub (Dec 8, 2016): @netblue30 But my home folder is `/root`. If I do `echo $HOME` I get `/root`. But the whitelisting doesn't allow the program to read the files inside that folder (program says file is not found).
Author
Owner

@peterzhu2118 commented on GitHub (Dec 8, 2016):

It seems to be caused by the private flag in the profile file, if I remove the flag it all works. But I need the program to be isolated so it can only see one folder.

<!-- gh-comment-id:265852056 --> @peterzhu2118 commented on GitHub (Dec 8, 2016): It seems to be caused by the `private` flag in the profile file, if I remove the flag it all works. But I need the program to be isolated so it can only see one folder.
Author
Owner

@netblue30 commented on GitHub (Dec 9, 2016):

Let me look into it, for now get rid of "private" in the profile.

<!-- gh-comment-id:266012520 --> @netblue30 commented on GitHub (Dec 9, 2016): Let me look into it, for now get rid of "private" in the profile.
Author
Owner

@peterzhu2118 commented on GitHub (Dec 9, 2016):

@netblue30 I need a new filesystem to be mounted on top of /root but I need one folder to carry over from the actual system into the new mounted one. Getting rid of private causes a huge security hole in my software.

<!-- gh-comment-id:266023118 --> @peterzhu2118 commented on GitHub (Dec 9, 2016): @netblue30 I need a new filesystem to be mounted on top of `/root` but I need one folder to carry over from the actual system into the new mounted one. Getting rid of `private` causes a huge security hole in my software.
Author
Owner

@netblue30 commented on GitHub (Dec 9, 2016):

No problem, I'll add proper whitelisting support for /root.

<!-- gh-comment-id:266023840 --> @netblue30 commented on GitHub (Dec 9, 2016): No problem, I'll add proper whitelisting support for /root.
Author
Owner

@peterzhu2118 commented on GitHub (Dec 9, 2016):

@netblue30 Ok thanks! Please let me know when you implement it!

<!-- gh-comment-id:266024076 --> @peterzhu2118 commented on GitHub (Dec 9, 2016): @netblue30 Ok thanks! Please let me know when you implement it!
Author
Owner

@netblue30 commented on GitHub (Dec 9, 2016):

I would say by the end of the weekend it should be in.

<!-- gh-comment-id:266024701 --> @netblue30 commented on GitHub (Dec 9, 2016): I would say by the end of the weekend it should be in.
Author
Owner

@netblue30 commented on GitHub (Dec 11, 2016):

It looks like is already supported! The problem is "private" command in the default profile for running root sandboxes. The profile is /etc/firejail/server.profile. Start the sandbox as root this way:

# firejail --ignore=private --whitelist=/root/Documents
<!-- gh-comment-id:266283383 --> @netblue30 commented on GitHub (Dec 11, 2016): It looks like is already supported! The problem is "private" command in the default profile for running root sandboxes. The profile is /etc/firejail/server.profile. Start the sandbox as root this way: ````` # firejail --ignore=private --whitelist=/root/Documents `````
Author
Owner

@peterzhu2118 commented on GitHub (Dec 11, 2016):

@netblue30 Thanks, that fixed the problem. But is there any way to place that in a config file so that I don't have to type all of that in every time?

<!-- gh-comment-id:266285115 --> @peterzhu2118 commented on GitHub (Dec 11, 2016): @netblue30 Thanks, that fixed the problem. But is there any way to place that in a config file so that I don't have to type all of that in every time?
Author
Owner

@netblue30 commented on GitHub (Dec 13, 2016):

Create a custom profile (as root):

# mkdir -p ~/.config/firejail
# cp /etc/firejail/server.profile ~/.config/firejail/.

Open ~/.config/firejail/server.profile and comment out private line (add a #).

<!-- gh-comment-id:266738010 --> @netblue30 commented on GitHub (Dec 13, 2016): Create a custom profile (as root): ````` # mkdir -p ~/.config/firejail # cp /etc/firejail/server.profile ~/.config/firejail/. ````` Open ~/.config/firejail/server.profile and comment out private line (add a #).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#653
No description provided.