[GH-ISSUE #720] HOME environment variable not adjusted when using --user #492

Closed
opened 2026-05-05 05:57:44 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @lheckemann on GitHub (Aug 16, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/720

$ sudo firejail --user=$USER sh
$ echo $HOME
/root
Originally created by @lheckemann on GitHub (Aug 16, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/720 ``` $ sudo firejail --user=$USER sh $ echo $HOME /root ```
gitea-mirror 2026-05-05 05:57:44 -06:00
Author
Owner

@Fred-Barclay commented on GitHub (Aug 16, 2016):

I believe this from the README.md might help:
--user option was deprecated, please use "sudo -u username firejail application" instead.
😸

<!-- gh-comment-id:240183111 --> @Fred-Barclay commented on GitHub (Aug 16, 2016): I believe this from the README.md might help: `--user option was deprecated, please use "sudo -u username firejail application" instead.` :smile_cat:
Author
Owner

@lheckemann commented on GitHub (Aug 16, 2016):

Oops. But I guess there's no way to give an unprivileged jail capabilities then?

<!-- gh-comment-id:240228279 --> @lheckemann commented on GitHub (Aug 16, 2016): Oops. But I guess there's no way to give an unprivileged jail capabilities then?
Author
Owner

@Fred-Barclay commented on GitHub (Aug 16, 2016):

I don't know about that; maybe @netblue30 or someone else with more experience could answer that better than I could. It will probably also depend on which capabilities you want to give the jail. 😉
But my guess would be sudo -u root firejail <application>.

<!-- gh-comment-id:240252041 --> @Fred-Barclay commented on GitHub (Aug 16, 2016): I don't know about that; maybe @netblue30 or someone else with more experience could answer that better than I could. It will probably also depend on _which_ capabilities you want to give the jail. :wink: But my guess would be `sudo -u root firejail <application>`.
Author
Owner

@lheckemann commented on GitHub (Aug 16, 2016):

But I don't want to run it as root, I want to run it as an unprivileged user gaining just certain capabilities like net_bind_service.

<!-- gh-comment-id:240254327 --> @lheckemann commented on GitHub (Aug 16, 2016): But I don't want to run it as root, I want to run it as an unprivileged user gaining just certain capabilities like `net_bind_service`.
Author
Owner

@netblue30 commented on GitHub (Aug 17, 2016):

I had to remove --user because it was equivalent with "sudo -u username firejail application".

If you need a program to keep certain capabilities, the standard way is to use "setcap" command. Here is an example of how they do it for ping: https://linux-audit.com/linux-capabilities-hardening-linux-binaries-by-removing-setuid/

<!-- gh-comment-id:240398509 --> @netblue30 commented on GitHub (Aug 17, 2016): I had to remove --user because it was equivalent with "sudo -u username firejail application". If you need a program to keep certain capabilities, the standard way is to use "setcap" command. Here is an example of how they do it for ping: https://linux-audit.com/linux-capabilities-hardening-linux-binaries-by-removing-setuid/
Author
Owner

@lheckemann commented on GitHub (Aug 17, 2016):

Ah right, thanks!

<!-- gh-comment-id:240442577 --> @lheckemann commented on GitHub (Aug 17, 2016): Ah right, thanks!
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#492
No description provided.