[GH-ISSUE #3448] --private-bin=something does not seem to work #2164

Closed
opened 2026-05-05 08:50:32 -06:00 by gitea-mirror · 12 comments
Owner

Originally created by @heinrich5991 on GitHub (Jun 3, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3448

--private-bin=something does not seem to work for me.

Bug and expected behavior

> firejail --private-bin=ls ls
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 2449111, child pid 2449112
1 program installed in 2.40 ms
Warning: /sbin directory link was not blacklisted
Warning: /usr/sbin directory link was not blacklisted
Child process initialized in 47.81 ms
execvp: No such file or directory

Parent is shutting down, bye...

I expected ls to execute given that I whitelisted it with --private-bin.

No profile or disabling firejail

  • firejail --private-bin=ls --noprofile ls also doesn't work.
  • firejail --noprofile ls obviously works, so does firejail ls.
  • Calling the program directly (ls) obviously also works.

Reproduce
Steps to reproduce the behavior:

  1. Run in bash firejail --private-bin=ls ls
  2. See error execvp: No such file or directory

Environment

  • Arch Linux
firejail version 0.9.62

Compile time support:
	- AppArmor support is enabled
	- AppImage support is enabled
	- chroot support is enabled
	- file and directory whitelisting support is enabled
	- file transfer support is enabled
	- firetunnel support is enabled
	- networking support is enabled
	- overlayfs support is enabled
	- private-home support is enabled
	- seccomp-bpf support is enabled
	- user namespace support is enabled
	- X11 sandboxing support is enabled

fish is my default shell, but both setting the SHELL variable to /bin/bash and executing from bash did not seem to help.

No other programs interact with the affected program for the functionality.

Additional context
I figured out that the default Discord profile does not work for me due to the private-bin directives. I narrowed it down to private-bin not working in general for me. Might have something to do with fish being my default shell: #2934.

Checklist

  • The upstream profile (and redirect profile if exists) have no changes fixing it.
  • The upstream profile exists (find / -name 'firejail' 2>/dev/null/fd firejail to locate profiles ie in /usr/local/etc/firejail/PROGRAM.profile)
  • Programs needed for interaction are listed.
  • Error was checked in search engine and on issue list without success. Similar issue: #2934, but this is not about joining an existing container.
Originally created by @heinrich5991 on GitHub (Jun 3, 2020). Original GitHub issue: https://github.com/netblue30/firejail/issues/3448 `--private-bin=something` does not seem to work for me. **Bug and expected behavior** ``` > firejail --private-bin=ls ls Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/disable-programs.inc ** Note: you can use --noprofile to disable default.profile ** Parent pid 2449111, child pid 2449112 1 program installed in 2.40 ms Warning: /sbin directory link was not blacklisted Warning: /usr/sbin directory link was not blacklisted Child process initialized in 47.81 ms execvp: No such file or directory Parent is shutting down, bye... ``` I expected `ls` to execute given that I whitelisted it with `--private-bin`. **No profile or disabling firejail** - `firejail --private-bin=ls --noprofile ls` also doesn't work. - `firejail --noprofile ls` obviously works, so does `firejail ls`. - Calling the program directly (`ls`) obviously also works. **Reproduce** Steps to reproduce the behavior: 1. Run in bash `firejail --private-bin=ls ls` 2. See error `execvp: No such file or directory` **Environment** - Arch Linux ``` firejail version 0.9.62 Compile time support: - AppArmor support is enabled - AppImage support is enabled - chroot support is enabled - file and directory whitelisting support is enabled - file transfer support is enabled - firetunnel support is enabled - networking support is enabled - overlayfs support is enabled - private-home support is enabled - seccomp-bpf support is enabled - user namespace support is enabled - X11 sandboxing support is enabled ``` `fish` is my default shell, but both setting the `SHELL` variable to `/bin/bash` and executing from bash did not seem to help. No other programs interact with the affected program for the functionality. **Additional context** I figured out that the default Discord profile does not work for me due to the `private-bin` directives. I narrowed it down to `private-bin` not working in general for me. Might have something to do with `fish` being my default shell: #2934. **Checklist** - [x] The upstream profile (and redirect profile if exists) have no changes fixing it. - [x] The upstream profile exists (`find / -name 'firejail' 2>/dev/null`/`fd firejail` to locate profiles ie in `/usr/local/etc/firejail/PROGRAM.profile`) - [x] Programs needed for interaction are listed. - [x] Error was checked in search engine and on issue list without success. Similar issue: #2934, but this is not about joining an existing container.
Author
Owner

@rusty-snake commented on GitHub (Jun 3, 2020):

Can you try with bash.

chsh -s /bin/bash
logout
firejail --private-bin=ls --noprofile ls

Can you try adding --shell=none:
firejail --private-bin=ls --shell=none --noprofile ls

Works firejail --private-bin=ls,fish --noprofile ls and firejail --private-bin=ls --noprofile /bin/ls

NOTE: Not having a shell inside the sandbox, but starting a program in a shell is expected to fail.

<!-- gh-comment-id:638436782 --> @rusty-snake commented on GitHub (Jun 3, 2020): Can you try with bash. ``` chsh -s /bin/bash logout firejail --private-bin=ls --noprofile ls ``` Can you try adding `--shell=none`: `firejail --private-bin=ls --shell=none --noprofile ls` Works `firejail --private-bin=ls,fish --noprofile ls` and `firejail --private-bin=ls --noprofile /bin/ls` NOTE: Not having a shell inside the sandbox, but starting a program in a shell is expected to fail.
Author
Owner

@heinrich5991 commented on GitHub (Jun 3, 2020):

After changing the shell to bash using chsh -s /bin/bash and then logging in via SSH again:

$ firejail --private-bin=ls --noprofile ls
Parent pid 2553517, child pid 2553518
1 program installed in 2.80 ms
Child process initialized in 24.49 ms
execvp: No such file or directory

Parent is shutting down, bye...

firejail --private-bin=ls --shell=none --noprofile ls works. firejail --private-bin=ls,bash --noprofile ls works if bash is my default shell.

firejail --private-bin=ls,fish --noprofile ls kinda works with a warning:

> firejail --private-bin=ls,fish --noprofile ls
Parent pid 2558462, child pid 2558463
2 programs installed in 13.06 ms
Child process initialized in 20.74 ms
fish: Unknown command: '['
/usr/share/fish/functions/isatty.fish (line 32): 
    command [ -t "$fd" ]
            ^
in function 'isatty' with arguments 'stdout'
	called on line 14 of file /usr/share/fish/functions/ls.fish
in function 'ls'
[...]
Parent is shutting down, bye...
<!-- gh-comment-id:638467927 --> @heinrich5991 commented on GitHub (Jun 3, 2020): After changing the shell to bash using `chsh -s /bin/bash` and then logging in via SSH again: ``` $ firejail --private-bin=ls --noprofile ls Parent pid 2553517, child pid 2553518 1 program installed in 2.80 ms Child process initialized in 24.49 ms execvp: No such file or directory Parent is shutting down, bye... ``` `firejail --private-bin=ls --shell=none --noprofile ls` works. `firejail --private-bin=ls,bash --noprofile ls` works if bash is my default shell. `firejail --private-bin=ls,fish --noprofile ls` kinda works with a warning: ``` > firejail --private-bin=ls,fish --noprofile ls Parent pid 2558462, child pid 2558463 2 programs installed in 13.06 ms Child process initialized in 20.74 ms fish: Unknown command: '[' /usr/share/fish/functions/isatty.fish (line 32): command [ -t "$fd" ] ^ in function 'isatty' with arguments 'stdout' called on line 14 of file /usr/share/fish/functions/ls.fish in function 'ls' [...] Parent is shutting down, bye... ```
Author
Owner

@heinrich5991 commented on GitHub (Jun 3, 2020):

It's unexpected for me that firejail calls the shell btw.

<!-- gh-comment-id:638475272 --> @heinrich5991 commented on GitHub (Jun 3, 2020): It's unexpected for me that firejail calls the shell btw.
Author
Owner

@heinrich5991 commented on GitHub (Jun 4, 2020):

> firejail --noprofile --private-bin=ls --debug ls
Autoselecting /usr/bin/fish as shell
Building quoted command line: 'ls' 
Command name #ls#
DISPLAY=:0 parsed as 0
Using the local network stack
Parent pid 24675, child pid 24676
Initializing child process
Host network configured
PID namespace installed
Mounting tmpfs on /run/firejail/mnt directory
Creating empty /run/firejail/mnt/seccomp directory
Creating empty /run/firejail/mnt/seccomp/seccomp.protocol file
Creating empty /run/firejail/mnt/seccomp/seccomp.postexec file
Mounting /proc filesystem representing the PID namespace
Basic read-only filesystem:
Mounting read-only /etc
Mounting noexec /etc
Mounting read-only /var
Mounting noexec /var
Mounting read-only /bin
Mounting read-only /lib
Mounting read-only /usr
Mounting tmpfs on /var/lock
Mounting tmpfs on /var/tmp
Mounting tmpfs on /var/log
Mounting tmpfs on /var/lib/nginx
Create the new utmp file
Mount the new utmp file
Cleaning /home directory
Cleaning /run/user directory
Sanitizing /etc/passwd, UID_MIN 1000
Sanitizing /etc/group, GID_MIN 1000
Disable /home/user/.config/firejail
Disable /run/firejail/network
Disable /run/firejail/bandwidth
Disable /run/firejail/name
Disable /run/firejail/profile
Disable /run/firejail/x11
Copying files in the new bin directory
Checking /usr/local/bin/ls
Checking /usr/bin/ls
sbox run: /run/firejail/lib/fcopy /usr/bin/ls /run/firejail/mnt/bin (null) 
Mount-bind /run/firejail/mnt/bin on top of /usr/local/bin
Mount-bind /run/firejail/mnt/bin on top of /usr/bin
Mount-bind /run/firejail/mnt/bin on top of /bin
Mount-bind /run/firejail/mnt/bin on top of /usr/local/games
Mount-bind /run/firejail/mnt/bin on top of /usr/local/sbin
Mount-bind /run/firejail/mnt/bin on top of /usr/sbin
Mount-bind /run/firejail/mnt/bin on top of /sbin
1 program installed in 2.22 ms
Mounting read-only /proc/sys
Remounting /sys directory
Disable /sys/firmware
Disable /sys/hypervisor
Disable /sys/power
Disable /sys/kernel/debug
Disable /sys/kernel/vmcoreinfo
Disable /proc/sys/fs/binfmt_misc
Disable /proc/sys/kernel/core_pattern
Disable /proc/sys/kernel/modprobe
Disable /proc/sysrq-trigger
Disable /proc/sys/vm/panic_on_oom
Disable /proc/irq
Disable /proc/bus
Disable /proc/sched_debug
Disable /proc/timer_list
Disable /proc/kcore
Disable /proc/kallsyms
Disable /usr/lib/modules (requested /lib/modules)
Disable /boot
Disable /dev/port
Disable /run/user/1000/gnupg
Disable /run/user/1000/systemd
Disable /dev/kmsg
Disable /proc/kmsg
Disable /sys/fs
Disable /sys/module
Mounting noexec /run/firejail/mnt/pulse
Mounting /run/firejail/mnt/pulse on /home/user/.config/pulse
1234 1206 0:99 /pulse /home/user/.config/pulse rw,nosuid,nodev,noexec - tmpfs tmpfs rw,mode=755
mountid=1234 fsname=/pulse dir=/home/user/.config/pulse fstype=tmpfs
Current directory: /home/user
DISPLAY=:0 parsed as 0
Mounting read-only /run/firejail/mnt/seccomp
Drop privileges: pid 1, uid 1000, gid 100, nogroups 0
starting application
LD_PRELOAD=(null)
Running 'ls'  command through /usr/bin/fish
execvp argument 0: /usr/bin/fish
execvp argument 1: -c
execvp argument 2: 'ls' 
Child process initialized in 8.89 ms
execvp: No such file or directory
monitoring pid 3

Sandbox monitor: waitpid 3 retval 3 status 256

Parent is shutting down, bye...
<!-- gh-comment-id:638709981 --> @heinrich5991 commented on GitHub (Jun 4, 2020): ``` > firejail --noprofile --private-bin=ls --debug ls Autoselecting /usr/bin/fish as shell Building quoted command line: 'ls' Command name #ls# DISPLAY=:0 parsed as 0 Using the local network stack Parent pid 24675, child pid 24676 Initializing child process Host network configured PID namespace installed Mounting tmpfs on /run/firejail/mnt directory Creating empty /run/firejail/mnt/seccomp directory Creating empty /run/firejail/mnt/seccomp/seccomp.protocol file Creating empty /run/firejail/mnt/seccomp/seccomp.postexec file Mounting /proc filesystem representing the PID namespace Basic read-only filesystem: Mounting read-only /etc Mounting noexec /etc Mounting read-only /var Mounting noexec /var Mounting read-only /bin Mounting read-only /lib Mounting read-only /usr Mounting tmpfs on /var/lock Mounting tmpfs on /var/tmp Mounting tmpfs on /var/log Mounting tmpfs on /var/lib/nginx Create the new utmp file Mount the new utmp file Cleaning /home directory Cleaning /run/user directory Sanitizing /etc/passwd, UID_MIN 1000 Sanitizing /etc/group, GID_MIN 1000 Disable /home/user/.config/firejail Disable /run/firejail/network Disable /run/firejail/bandwidth Disable /run/firejail/name Disable /run/firejail/profile Disable /run/firejail/x11 Copying files in the new bin directory Checking /usr/local/bin/ls Checking /usr/bin/ls sbox run: /run/firejail/lib/fcopy /usr/bin/ls /run/firejail/mnt/bin (null) Mount-bind /run/firejail/mnt/bin on top of /usr/local/bin Mount-bind /run/firejail/mnt/bin on top of /usr/bin Mount-bind /run/firejail/mnt/bin on top of /bin Mount-bind /run/firejail/mnt/bin on top of /usr/local/games Mount-bind /run/firejail/mnt/bin on top of /usr/local/sbin Mount-bind /run/firejail/mnt/bin on top of /usr/sbin Mount-bind /run/firejail/mnt/bin on top of /sbin 1 program installed in 2.22 ms Mounting read-only /proc/sys Remounting /sys directory Disable /sys/firmware Disable /sys/hypervisor Disable /sys/power Disable /sys/kernel/debug Disable /sys/kernel/vmcoreinfo Disable /proc/sys/fs/binfmt_misc Disable /proc/sys/kernel/core_pattern Disable /proc/sys/kernel/modprobe Disable /proc/sysrq-trigger Disable /proc/sys/vm/panic_on_oom Disable /proc/irq Disable /proc/bus Disable /proc/sched_debug Disable /proc/timer_list Disable /proc/kcore Disable /proc/kallsyms Disable /usr/lib/modules (requested /lib/modules) Disable /boot Disable /dev/port Disable /run/user/1000/gnupg Disable /run/user/1000/systemd Disable /dev/kmsg Disable /proc/kmsg Disable /sys/fs Disable /sys/module Mounting noexec /run/firejail/mnt/pulse Mounting /run/firejail/mnt/pulse on /home/user/.config/pulse 1234 1206 0:99 /pulse /home/user/.config/pulse rw,nosuid,nodev,noexec - tmpfs tmpfs rw,mode=755 mountid=1234 fsname=/pulse dir=/home/user/.config/pulse fstype=tmpfs Current directory: /home/user DISPLAY=:0 parsed as 0 Mounting read-only /run/firejail/mnt/seccomp Drop privileges: pid 1, uid 1000, gid 100, nogroups 0 starting application LD_PRELOAD=(null) Running 'ls' command through /usr/bin/fish execvp argument 0: /usr/bin/fish execvp argument 1: -c execvp argument 2: 'ls' Child process initialized in 8.89 ms execvp: No such file or directory monitoring pid 3 Sandbox monitor: waitpid 3 retval 3 status 256 Parent is shutting down, bye... ```
Author
Owner

@rusty-snake commented on GitHub (Jun 4, 2020):

I'm probably endlessly saying it, but let me repeat it one more time: A not POSIX compatible login-shell is a bad Idea. Programs break badly, you need to debug strength issues and have a potential security-hole because of others escape rules. Guys, use bash as login-shell and set you favourite interactive-shell in your terminal-emulator/multiplexer.

<!-- gh-comment-id:638766612 --> @rusty-snake commented on GitHub (Jun 4, 2020): I'm probably endlessly saying it, but let me repeat it one more time: A not POSIX compatible login-shell is a bad Idea. Programs break badly, you need to debug strength issues and have a potential security-hole because of others escape rules. Guys, use bash as login-shell and set you favourite interactive-shell in your terminal-emulator/multiplexer.
Author
Owner

@rusty-snake commented on GitHub (Jun 4, 2020):

firejail --private-bin=ls,fish --noprofile ls kinda works with a warning:

Looks like [ is not a build-in of fish. Unfortunately you can't add it (#3381).

<!-- gh-comment-id:638767317 --> @rusty-snake commented on GitHub (Jun 4, 2020): >firejail --private-bin=ls,fish --noprofile ls kinda works with a warning: Looks like `[` is not a build-in of fish. Unfortunately you can't add it (#3381).
Author
Owner

@rusty-snake commented on GitHub (Jun 4, 2020):

It's unexpected for me that firejail calls the shell btw.

--shell=none
Run the program directly, without a user shell.

Example:
$ firejail --shell=none script.sh
--shell=program
Set default user shell. Use this shell to run the application using -c shell option. For example "firejail --shell=/bin/dash firefox" will
start Mozilla Firefox as "/bin/dash -c firefox". By default Bash shell (/bin/bash) is used.

<!-- gh-comment-id:638768687 --> @rusty-snake commented on GitHub (Jun 4, 2020): > It's unexpected for me that firejail calls the shell btw. > **--shell=none** > Run the program directly, without a user shell. > > Example: > $ firejail --shell=none script.sh > **--shell=program** > Set default user shell. Use this shell to run the application using -c shell option. For example "firejail --shell=/bin/dash firefox" will > start Mozilla Firefox as "/bin/dash -c firefox". By default Bash shell (/bin/bash) is used.
Author
Owner

@heinrich5991 commented on GitHub (Jun 4, 2020):

I'm probably endlessly saying it, but let me repeat it one more time: A not POSIX compatible login-shell is a bad Idea. Programs break badly, you need to debug strength issues and have a potential security-hole because of others escape rules. Guys, use bash as login-shell and set you favourite interactive-shell in your terminal-emulator/multiplexer.

No, firejail is the first program for me that breaks under fish. If it is related to fish that firejail breaks, that seems to be a firejail problem. I have been using fish for over a year as my login shell.

I can't comment on the security holes because those aren't visible to users.

Note that the problem does not seem to be related to fish though, it also fails in bash (see https://github.com/netblue30/firejail/issues/3448#issuecomment-638467927).

Can you explain what benefit firejail gets by executing a shell with each command by default?

<!-- gh-comment-id:638775249 --> @heinrich5991 commented on GitHub (Jun 4, 2020): > I'm probably endlessly saying it, but let me repeat it one more time: A not POSIX compatible login-shell is a bad Idea. **Programs break badly,** you need to debug strength issues and have a potential security-hole because of others escape rules. Guys, use bash as login-shell and set you favourite interactive-shell in your terminal-emulator/multiplexer. No, firejail is the first program for me that breaks under `fish`. If it is related to fish that firejail breaks, that seems to be a firejail problem. I have been using fish for over a year as my login shell. I can't comment on the security holes because those aren't visible to users. Note that the problem does not seem to be related to fish though, it also fails in bash (see https://github.com/netblue30/firejail/issues/3448#issuecomment-638467927). Can you explain what benefit firejail gets by executing a shell with each command by default?
Author
Owner

@rusty-snake commented on GitHub (Jun 4, 2020):

No, firejail is the first program for me that breaks under fish. If it is related to fish that firejail breaks, that seems to be a firejail problem. I have been using fish for over a year as my login shell.

I've seen more program that assume bash as login-shell, and can only tell what IMHO the best is.

<!-- gh-comment-id:638779157 --> @rusty-snake commented on GitHub (Jun 4, 2020): > No, firejail is the first program for me that breaks under fish. If it is related to fish that firejail breaks, that seems to be a firejail problem. I have been using fish for over a year as my login shell. I've seen more program that assume bash as login-shell, and can only tell what IMHO the best is.
Author
Owner

@rusty-snake commented on GitHub (Sep 1, 2020):

Closing here, we still have #3434.

<!-- gh-comment-id:684822122 --> @rusty-snake commented on GitHub (Sep 1, 2020): Closing here, we still have #3434.
Author
Owner

@rusty-snake commented on GitHub (Jun 20, 2022):

shell none becomes default (#5196).

<!-- gh-comment-id:1160568895 --> @rusty-snake commented on GitHub (Jun 20, 2022): `shell none` becomes default (#5196).
Author
Owner

@heinrich5991 commented on GitHub (Jun 21, 2022):

Nice! :)

<!-- gh-comment-id:1161635070 --> @heinrich5991 commented on GitHub (Jun 21, 2022): Nice! :)
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#2164
No description provided.