[GH-ISSUE #907] firejail --join does not inherit environment #615

Open
opened 2026-05-05 06:17:04 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @pyamsoft on GitHub (Nov 11, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/907

Originally assigned to: @chiraag-nataraj on GitHub.

Using firejail 0.9.44

If I launch a jail with, for example, the following command:

firejail --env=PATH=/bin bash

A new jail is launched running bash. When echoing the PATH in this jail instance, it is as expected

$ echo $PATH
/bin

However, when I attempt to join this jail using firejail --join=<pid>, echoing the PATH returns the PATH of the real machine, not the jail itself. This inconsistency also applies to any other environment variables set via the --env or env in profiles in firejail. This means that a custom environment variable like

firejail --env=TESTING_VARIABLE=1 bash

will appear in the initially launched jail, but will not be available if you join the jail from somewhere else. It seems like when joining a jail instance, the --env variables are not re-applied to the joined instance.
I believe this behavior to be a bug.

Originally created by @pyamsoft on GitHub (Nov 11, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/907 Originally assigned to: @chiraag-nataraj on GitHub. Using firejail 0.9.44 If I launch a jail with, for example, the following command: ``` firejail --env=PATH=/bin bash ``` A new jail is launched running bash. When echoing the PATH in this jail instance, it is as expected ``` $ echo $PATH /bin ``` However, when I attempt to join this jail using `firejail --join=<pid>`, echoing the PATH returns the PATH of the real machine, not the jail itself. This inconsistency also applies to any other environment variables set via the --env or env in profiles in firejail. This means that a custom environment variable like ``` firejail --env=TESTING_VARIABLE=1 bash ``` will appear in the initially launched jail, but will not be available if you join the jail from somewhere else. It seems like when joining a jail instance, the --env variables are not re-applied to the joined instance. I believe this behavior to be a bug.
gitea-mirror added the
enhancement
label 2026-05-05 06:17:04 -06:00
Author
Owner

@netblue30 commented on GitHub (Nov 12, 2016):

I'll bring a fix in, thanks.

<!-- gh-comment-id:260120794 --> @netblue30 commented on GitHub (Nov 12, 2016): I'll bring a fix in, thanks.
Author
Owner

@chiraag-nataraj commented on GitHub (Aug 21, 2018):

@netblue30 This still appears to be around.

<!-- gh-comment-id:414707843 --> @chiraag-nataraj commented on GitHub (Aug 21, 2018): @netblue30 This still appears to be around.
Author
Owner

@chiraag-nataraj commented on GitHub (May 21, 2019):

Hmm, this is still an issue.

<!-- gh-comment-id:494347513 --> @chiraag-nataraj commented on GitHub (May 21, 2019): Hmm, this is still an issue.
Author
Owner

@chiraag-nataraj commented on GitHub (May 23, 2019):

So default environment variables are being applied, but the issue is that there's no way to know a priori what environment variables need to be set again...start_application does a env_defaults(); env_apply(), which sets up the default environment variables and then applies them.

<!-- gh-comment-id:495142685 --> @chiraag-nataraj commented on GitHub (May 23, 2019): So _default_ environment variables are being applied, but the issue is that there's no way to know a priori what environment variables need to be set again...`start_application` does a `env_defaults(); env_apply()`, which sets up the default environment variables and then applies them.
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#615
No description provided.