| Summary: | Let jexec execute shell if no command is issued. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Willem Jan Withagen <wjw> | ||||||
| Component: | bin | Assignee: | Jamie Gritton <jamie> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Only Me | CC: | emaste, jamie | ||||||
| Priority: | --- | Keywords: | patch | ||||||
| Version: | 10.1-STABLE | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
Created attachment 158629 [details]
alternate patch, including -l option
I've kept to the spirit of your patch, but reworked it with a few changes. Instead of hard-coding a username "root", I default to leaving the environment along unless a user (or -l) is specified. In the absence of a specified user, I run the current environment's shell instead of root's. I run the shell with the "-i" argument, as chroot does.
I've also added a "-l" argument for a "clean" environment, same as jail(8)'s "exec.clean" parameter.
(In reply to Jamie Gritton from comment #1) I like your patch, especially the clean option. Other parts of the patch look like one of my earlier tries which I considered to much...., including rewriting the macro to a function. But with the clean-stuff it does make much more sense. A commit references this bug: Author: jamie Date: Sun Jul 12 17:03:52 UTC 2015 New revision: 285420 URL: https://svnweb.freebsd.org/changeset/base/285420 Log: Run a shell in the jail when no command is specified. Add a new flag, -l, for a clean environment, same as jail(8) exec.clean. Change the GET_USER_INFO macro into a function. PR: 201300 Submitted by: Willem Jan Withagen MFC after: 3 days Changes: head/usr.sbin/jexec/jexec.8 head/usr.sbin/jexec/jexec.c A commit references this bug: Author: jamie Date: Thu Jul 30 04:53:54 UTC 2015 New revision: 286064 URL: https://svnweb.freebsd.org/changeset/base/286064 Log: MFC r285420: Run a shell in the jail when no command is specified. Add a new flag, -l, for a clean environment, same as jail(8) exec.clean. Change the GET_USER_INFO macro into a function. PR: 201300 Submitted by: Willem Jan Withagen Changes: _U stable/10/ stable/10/usr.sbin/jexec/jexec.8 stable/10/usr.sbin/jexec/jexec.c |
Created attachment 158277 [details] Allow Jexec command to be empty, and start a shell jexec does require a command as parameter. unlike for instance chroot (or sudo if configure so) This patch adds the same functionality to jexec and allows: jexec <jid> Which gets you a shell in the jail. --WjW