I often want to ssh into a different server, but retain my working directory. (All our servers have the same NFS and thus the same directory path usually exists on all servers.) Is it possible to do this?
If the remote server has been preconfigured (in sshd_config) with
And you include
as the last line in the remote servers' ~/.bashrc, you can connect with
It's a workaround, but it'll...work.
If you can't change the remote servers's configuration and use key-based SSH logins with an
On your local machine, create a wrapper script which is in your path (eg.
On the remote machine, add the following part to your
Obviously, this is a wild hack, but it works.