[Bug 245236] [suggestion] change the default shell for jexec

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 22 Jun 2021 01:45:21 UTC

--- Comment #2 from dewayne@heuristicsystems.com.au ---
(In reply to Please from comment #0)
Perhaps changing the shell in /etc/master.passwd will solve the problem?

Running as root using csh. When I define two users bob uses /bin/sh, alice uses
/bin/tcsh using vipw.
# jexec -U bob testjail
$ echo $SHELL

# jexec -U alice testjail
> echo $SHELL

# jexec -U bob testjail /bin/sh -c 'echo $SHELL'
# jexec -U alice testjail /bin/sh -c 'echo $SHELL'

which works nicely. 

However with
# jexec -U bob testjail echo $SHELL
The SHELL variable has been evaluated before entering the jail, while
# jexec -U alice testjail sysctl kern.hostname
kern.hostname: testjail

With your example
#jexec 1 /usr/local/bin/bash
#echo $SHELL
You're invoking the bash shell, which you are working in, within the jail, but
examining the jailed user's SHELL variable, defined in passwd (or some dot

I hope this is helpful and I suspect does what is expected.

You are receiving this mail because:
You are the assignee for the bug.