Prompt containing SSH login information
Artis Caune
artis.caune at gmail.com
Wed Nov 25 08:35:08 UTC 2009
2009/11/24 Polytropon <freebsd at 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:
>
> me at sys1:~% ssh me at sys2
> me at sys2:~% _
>
> I'd like the second prompt that I've been logged into sys2 by
> sys1, such as
>
> me at 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="$MYPROMPT>$USER@$(hostname -s)"
export MYPROMPT
and you will get more than two hosts:
me at sys1>me at sys2>me at 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>
...
--
Artis Caune
Everything should be made as simple as possible, but not simpler.
More information about the freebsd-questions
mailing list