I host several domains on one server.
I would like to be able to change the displayed hostname in my bash prompt to indicate which one I picked when ssh'ing into the server.
My prompt is as follows:
\u@\h
This displays as:
user@hostname
How would I change the \h
to show which domain I had logged-into (blah.net, hmm.com, etc)?
Best Answer
It turns out that
ssh
finds lines inssh_config(5)
by string matching, so it's OK if all the IP's are the same.What you want, then, are
.ssh/config
for each system, useHostName
to givessh
the real host domain name.ssh/config
send a different variable usingSendEnv
, seeman ssh_config
.AcceptEnv *
in/etc/ssh/sshd_config
andsudo kill -1 $(cat /var/run/sshd.pid)
(
AcceptEnv E1 E2 E3
should also work.)Example.
Client
.ssh/config
Server
.bashrc
Server
/etc/ssh/sshd_config