From nobody Tue Oct 10 23:20:14 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S4sM311KCz4wTWm; Tue, 10 Oct 2023 23:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4sM30WCFz4PSD; Tue, 10 Oct 2023 23:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696980015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WRcWeY4zlqYRSkmair1ru0tlOOcUFQMl/+eUaBtRr3M=; b=BW214e+rum5MRr6Az7K78Pg/Q/spQ5/GyZxajBpNOV+XZeqilbA6R0Hp/T+CxDQs+zmNq5 8OKAapVaipvq0L8K6VH1WShXNDwm9dTtL47f9nVlfvRi3i1sdF0wZHguGuu8KtMIz5ZJzk Hjmq4rlLFWDsCvOlaKQ9XXoBZFhfXYXVmLZR539rEQ53SXXmgNrDcv/Ss/VzXxmY745TLk sl44buOKMRwun4Jx9ZJia+OKFReAVtikiKwGeGCrGhpZe9fh/6nR8lCYKFsj/aBR3jSVNJ +gUrfWvRQkdiYdW0yMNM14MuEmyu2sj1BTHazD5uP4/bokzi/sarBE6CaLUmIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696980015; a=rsa-sha256; cv=none; b=w/KgUm3MaCsnuTJYnmk7OwyYP/k31NixeNrg7DvLgYlP/GL/WJLYF+b5hWwrqEXXlgzCVW jppACwGYlB1dvFbIJL7z6sBAPXthtSukt46xfhzQesyv22EhrgDTRSFR2vPgn3if7Hvv9G fZgpcEK0M6JKySFJh4OPyXJPq0JRUl+sUOn0cO1U2qSFffkHwZJL5lNgKT2VipMz6R+UPB SPMFIWX1wUVRL/o2zfffLkqoB++hnr4TWeQczcgsljS2npVvzw0fokwYldFl8r3TlYdfXi LO4G6DMJ/YWWnV9BWH+HeUttgEq1HGXDWgrwipgqvLjyd9HOCg4wjE8aa1O2yA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696980015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WRcWeY4zlqYRSkmair1ru0tlOOcUFQMl/+eUaBtRr3M=; b=IQ+CaZhnNVMXTS63W36IpmlszV9VKBEzsdxFZGJpBxFocD1VLkNhOSYqfxVfIBHkvMELTj Rt2ENX19vgNbtUSQUbUxT3h5Z1PUBqKCm7pBnBjh8j09ZevJyf2qKJ6Bz2EVkvbfnlj5aD v4rsbVRBQh/kkPfcaxXpJruIcHmosr2WGhT6dBM7QHngLYaZepOK4HsSuvufRun6jTY07+ Bv0CvUJDBeX+UisD4W/kFODsThKUjGAffjhR1meJ3TtcD4bEnRm1LRECkdse3oJm4VRE/p THzGRvSynDPANN4OkIW5usOl4ri/IZ8MHCVOsvu+bnkgiVWx6u+j1OdO45MQjA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S4sM26hhSzxZ5; Tue, 10 Oct 2023 23:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39ANKEiO077060; Tue, 10 Oct 2023 23:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39ANKEGW077053; Tue, 10 Oct 2023 23:20:14 GMT (envelope-from git) Date: Tue, 10 Oct 2023 23:20:14 GMT Message-Id: <202310102320.39ANKEGW077053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Danilo G. Baio" Subject: git: 1595a4087b19 - stable/13 - jexec.8: Add examples section List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1595a4087b1947974b2f3fa18e31f79ab6a56572 Auto-Submitted: auto-generated The branch stable/13 has been updated by dbaio: URL: https://cgit.FreeBSD.org/src/commit/?id=1595a4087b1947974b2f3fa18e31f79ab6a56572 commit 1595a4087b1947974b2f3fa18e31f79ab6a56572 Author: Danilo G. Baio AuthorDate: 2023-10-07 22:44:44 +0000 Commit: Danilo G. Baio CommitDate: 2023-10-10 23:18:58 +0000 jexec.8: Add examples section MFC after: 3 days Reviewed by: gbe, 0mp, danfe, pauamma_gundo.com Differential Revision: https://reviews.freebsd.org/D40831 (cherry picked from commit 04c8bfc1761010c36081cf300fa751548d541122) --- usr.sbin/jexec/jexec.8 | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/usr.sbin/jexec/jexec.8 b/usr.sbin/jexec/jexec.8 index 69f380676c30..4400cbbe56a3 100644 --- a/usr.sbin/jexec/jexec.8 +++ b/usr.sbin/jexec/jexec.8 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 24, 2016 +.Dd October 7, 2023 .Dt JEXEC 8 .Os .Sh NAME @@ -65,6 +65,44 @@ The user name from jailed environment as whom the .Ar command should run. .El +.Sh EXAMPLES +.Ss Example 1 : Open a shell in a jail +The following command specifies a jail by its name and utilizes the current +user's shell: +.Pp +.Dl # jexec name +.Pp +It is also possible to specify a jail by its jid: +.Pp +.Dl # jexec JID +.Ss Example 2 : Run a single command without opening a shell +The following command runs +.Ql uname -a +in a jail called +.Dq name . +Since a command is specified explicitly, +.Nm +does not spawn an interactive shell. +Instead, +.Nm +executes the specified command directly. +.Pp +.Dl # jexec name uname -a +.Ss Example 3 : Open a shell in a jail with a clean environment +The following command opens a +.Xr sh 1 +shell in a jail with a clean environment: +.Pp +.Dl # jexec -l name sh +.Ss Example 4 : Open a shell in a jail with the login command +The following command utilizes +.Xr login 1 +to access the jail, submitting an audit record, and displaying the +user's last login, system copyright, and +.Xr motd 5 +message: +.Pp +.Dl # jexec -l name login -f root .Sh SEE ALSO .Xr jail_attach 2 , .Xr jail 8 ,