From owner-freebsd-questions@FreeBSD.ORG Wed Nov 25 08:35:08 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58173106566B for ; Wed, 25 Nov 2009 08:35:08 +0000 (UTC) (envelope-from artis.caune@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id DEEF58FC12 for ; Wed, 25 Nov 2009 08:35:07 +0000 (UTC) Received: by bwz5 with SMTP id 5so7111352bwz.3 for ; Wed, 25 Nov 2009 00:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gWuFj3gQ+Xgwp/xbZhIFu6M0Qrh/vwb9DtEkpb8YzQE=; b=IIIqgsOFILDIX1KB6Zo2DRjQppvUleLYOyPNP3B1UTqeQTg+7GQy5Okblzc4mcgQVc /oB8fd4XVujKRige3UReLYX/ke0oEh97VG1FUSqRMJp1okxXAAPN0kmcBUPVdHz8uXRv BJoboSPPIuEPx3lHN31BsgH3B3B15CUFbmrcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FV8GRIeg3EXxQUN5xTKC3W3Gcvpz7j2In5P3iwhxAMX1RJVYaLJk54fp1NqoJvWT8D D1GxEZp7Sq5Q2QUcmFiYbtUBC5HQ4rc+DBzvoGK+zQana4jMGgWmxWjwdHnALbgo5K6g NMyge5M+oJqRnaMOiP1b2bMz6L3/2yRlOyS1Y= MIME-Version: 1.0 Received: by 10.204.13.198 with SMTP id d6mr3232121bka.188.1259138106829; Wed, 25 Nov 2009 00:35:06 -0800 (PST) In-Reply-To: <20091124051038.1aef9ade.freebsd@edvax.de> References: <20091124051038.1aef9ade.freebsd@edvax.de> Date: Wed, 25 Nov 2009 10:35:06 +0200 Message-ID: <9e20d71e0911250035s20453a05n3298e1260891ec13@mail.gmail.com> From: Artis Caune To: Polytropon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Questions Subject: Re: Prompt containing SSH login information X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 08:35:08 -0000 2009/11/24 Polytropon : > Hi, > > again, a strange question: I'd like to know if there is a builtin > means to let the csh's (or bash's) prompt show an information if > the current dialog session has been opened via SSH from another > system. The obvious is: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0me@sys1:~% ssh me@sys2 > =C2=A0 =C2=A0 =C2=A0 =C2=A0me@sys2:~% _ > > I'd like the second prompt that I've been logged into sys2 by > sys1, such as > > =C2=A0 =C2=A0 =C2=A0 =C2=A0me@sys1>sys2:~% _ How about this: - On all servers add the following to sshd_config: AcceptEnv MYPROMPT - and the following to ssh_config: Host * SendEnv MYPROMPT - fix shell rc files on servers and workstation: MYPROMPT=3D"$MYPROMPT>$USER@$(hostname -s)" export MYPROMPT and you will get more than two hosts: me@sys1>me@sys2>me@sys3:~% We use this for root account to give every admin his own: /root/.zshrc. /root/.zlogin. /root/.zhistory. /root/.vimrc. /root/.viminfo. ... --=20 Artis Caune Everything should be made as simple as possible, but not simpler.