Is it possible, for each host, to set initial directory where shell would cd into when logged in? (not home)
For example, I have a snippet in ~/.ssh/config
Host mybusiness
Hostname mybusines.com
User plone
And now I can ssh to this host with ssh mybusiness
command, but always the first task I need to do is to type in the command cd /srv/www
Best Answer
I don't think that's possible, but you could config your shell's init script at the server. If you use bash at the server, you could add this line to the end of
~/.bashrc
at the server:Another option is to create a small script on your client for starting SSH-connections, which will run a remote command after login:
Run it like this: