1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00
freebsd/usr.sbin/jexec
Jamie Gritton 5cf7054917 jail: only chdir to user's home directory when user is specified
jail(8) with the "exec.clean" parameter not only cleans the enviromnent
variables before running commands, but also changes to the user's home
directory.  While this makes sense when auser is specified (via one of
the exec.*_user parameters), it leads to all commands being run in the
jail's /root directory even in the absence of an explicitly specified
user.  This can lead to problems when e.g. rc scripts are run from that
non-world-readable directory, and run counter to expectations that jail
startup is analogous to system startup.

Restrict this behvaiour to only users exlicitly specified, either via
the command line or jail parameters, but not the implicit root user.
While this changes long-stand practice, it's the more intuitive action.

jexec(8) has the same problem, and the same fix.

PR:		277210
Reported by:	johannes.kunde at gmail
Differential Revision:	https://reviews.freebsd.org/D46226
2024-08-12 15:23:28 -07:00
..
jexec.8 jail: only chdir to user's home directory when user is specified 2024-08-12 15:23:28 -07:00
jexec.c jail: only chdir to user's home directory when user is specified 2024-08-12 15:23:28 -07:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00