Take the tour ×  I wish to create the following script in
.profile, so each SSH session would go directly into its place:
1. Check the specified host (user@host).   2. If host = host1 --
cd /var/www/site1   Help! :)  share|improve this question add
comment  2 Answers  Your question is unclear: are you reaching
the same host through multiple aliases? Are you reaching
different hosts that share a .profile? Are you trying to execute
commands based on the source host name or on the target host
names?  If you want different effects on different remote hosts,
just test the remote host name:  case "$(hostname)" in   host1)
cd /var/www/site1;;  If you want different effects on the same
host, you can use the SendEnv directives in your ~/.ssh/config
to send environment variables (assuming you're using the OpenSSH
client). These need to be enabled with an AcceptEnv directive on
the server side, which is often not the case. However LC_*
variables are typically permitted through, so you can pass
information using these