From owner-freebsd-stable@FreeBSD.ORG Tue Aug 20 06:01:49 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 57AA0C06 for ; Tue, 20 Aug 2013 06:01:49 +0000 (UTC) (envelope-from dewayne.geraghty@heuristicsystems.com.au) Received: from nschwmtas02p.mx.bigpond.com (nschwmtas02p.mx.bigpond.com [61.9.189.140]) by mx1.freebsd.org (Postfix) with ESMTP id E4BC72498 for ; Tue, 20 Aug 2013 06:01:48 +0000 (UTC) Received: from nschwcmgw09p ([61.9.190.169]) by nschwmtas02p.mx.bigpond.com with ESMTP id <20130820060141.VNNV24.nschwmtas02p.mx.bigpond.com@nschwcmgw09p>; Tue, 20 Aug 2013 06:01:41 +0000 Received: from hermes.heuristicsystems.com.au ([58.172.113.247]) by nschwcmgw09p with BigPond Outbound id Eu1g1m0085LKYmq01u1goD; Tue, 20 Aug 2013 06:01:41 +0000 X-Authority-Analysis: v=2.0 cv=bcfpoZzB c=1 sm=1 a=YibVxx38Z+cwdCKSMcELyg==:17 a=twTT4oUKOlYA:10 a=kj9zAlcOel0A:10 a=GHIR_BbyAAAA:8 a=BwsYJDKy6eIA:10 a=6I5d2MoRAAAA:8 a=MHNr9V5fAAAA:8 a=Gf16wSQSqONCK67QmbYA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=YibVxx38Z+cwdCKSMcELyg==:117 Received: from white (white.hs [10.0.5.2]) (authenticated bits=0) by hermes.heuristicsystems.com.au (8.14.5/8.13.6) with ESMTP id r7K60Bjm039544; Tue, 20 Aug 2013 16:00:12 +1000 (EST) (envelope-from dewayne.geraghty@heuristicsystems.com.au) From: "Dewayne Geraghty" To: "'Florent Peterschmitt'" References: <520D0EBE.401@peterschmitt.fr> Subject: RE: Behavior of jexec Date: Tue, 20 Aug 2013 16:00:10 +1000 Message-ID: <2DC6613BDD194EEBA0BCDFD96A24A1A8@white> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <520D0EBE.401@peterschmitt.fr> Thread-Index: Ac6Z3FnflDA00O5SSP2bJj3/Lvcm8wDhXr2Q X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2013 06:01:49 -0000 > -----Original Message----- > From: owner-freebsd-stable@freebsd.org > [mailto:owner-freebsd-stable@freebsd.org] On Behalf Of > Florent Peterschmitt > Sent: Friday, 16 August 2013 3:24 AM > To: freebsd-stable@freebsd.org > Subject: Behavior of jexec > > Hi, > > I noticed two things when running jexec. I run FreeBSD > 9.2-RC1 from binaries and jails 9.2-RC1 too. > > I log as root on the host (I havn't any other user). > > # 1. $HOME > > For a jail named "blog" with a "blog" user, which $HOME is at > /home/blog, if I do: > > jexec -U blog blog tcsh > > My id is correct, but $HOME is still root. > > # 2. Accessing a jail in ssh command line > > I'm on my "client" machine and want to get on the "server" > machine, where jails are, and I want to do a jexec from ssh > command line: > > ssh katana jexec -U blog blog tcsh > > I get a connection (trusting /var/log/auth) but it hangs on > and do nothing. Event with a simple "ls" as jail command. > > Thanks. > > > -- > Florent Peterschmitt | Please: > florent@peterschmitt.fr | * Avoid HTML/RTF in E-mail. > +33 (0)6 64 33 97 92 | * Send PDF for documents. > http://florent.peterschmitt.fr | Thank you :) > > The behaviour is roughly what should be expected. It's helpful to keep in mind that the jail isn't running a getty or login process in the context of the jail. So using jexec -U blog blog tcsh you'll acquire the correct ID, but be dropped into '/'. Reading the jail code might be the only definitive statement as to why. When you ssh into the jail, there is no tty assigned to the session. You can force a tty by ssh -t katana jexec -U blog blog tcsh Which should give you what you require, a shell within the jail context and an id of blog. Regards, Dewayne.