I wish to create the following script in .profile, so each SSH session would go directly into its place:
- Check the specified host (user@host).
- If host = host1 -- cd /var/www/site1
etc.
Help! :)
|
feedback
|
|
I'm pretty certain SSH doesn't send the hostname to the server (it just uses it locally to look up an IP-address and to check keys etc). At least, not in a way that can be used in a shell script. See the output of Some SSH clients and some SSH servers allow the client to specify a value for one or more environment variables, conceivably you could use this to tell the server which directory to switch to. For example, see Putty configuration, connection, data or OpenSSH SendEnv option. Otherwise, you have one user-ID for each website with a different domain name or you have to offer the user a menu. | |||||
feedback
|
|
Your question is unclear: are you reaching the same host through multiple aliases? Are you reaching different hosts that share a If you want different effects on different remote hosts, just test the remote host name:
If you want different effects on the same host, you can use the
| |||
|
feedback
|