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

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 22 Jun 2021 01:45:21 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245236

--- Comment #2 from dewayne_at_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
/bin/sh

# jexec -U alice testjail
> echo $SHELL
/bin/tcsh

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

which works nicely. 

However with
# jexec -U bob testjail echo $SHELL
/bin/csh
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
/bin/csh
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
file)

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.
Received on Tue Jun 22 2021 - 01:45:21 UTC

Original text of this message