Date: Wed, 25 Nov 2009 10:35:06 +0200 From: Artis Caune <artis.caune@gmail.com> To: Polytropon <freebsd@edvax.de> Cc: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Prompt containing SSH login information Message-ID: <9e20d71e0911250035s20453a05n3298e1260891ec13@mail.gmail.com> In-Reply-To: <20091124051038.1aef9ade.freebsd@edvax.de> References: <20091124051038.1aef9ade.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/11/24 Polytropon <freebsd@edvax.de>: > 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.<admin> /root/.zlogin.<admin> /root/.zhistory.<admin> /root/.vimrc.<admin> /root/.viminfo.<admin> ... --=20 Artis Caune Everything should be made as simple as possible, but not simpler.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9e20d71e0911250035s20453a05n3298e1260891ec13>