Re: login into a particular directory using ssh
On Sun, 05 Dec 2004 18:48:19 -0500, David Mandelberg
> Miquel van Smoorenburg wrote:
> > ssh -t email@example.com 'cd / && exec /bin/bash'
> That works, but because this is a login shell, and the remote machine
> may differentiate between login and non-login shells, this is better:
> ssh -t firstname.lastname@example.org 'cd / && exec /bin/bash --login -i'
> Also don't forget the exec because otherwise you'd be running an extra
> shell or the single quotes before cd and after -i.
This does work perfectly. I am wondering if there is a clever trick to
do the following.
In the above examples we are specifying the destination directory. But
can this directory be obtained from the original machine?
For example, can I do something like
bash$export DYNAMIC=$(basename $PWD)
bash$ssh -t email@example.com 'cd $DYNAMIC && exec /bin/bash --login -i'
which dynamically determines the current directory on the ssh client
and puts me into that directory on the shell.example.net? Needless to
say, I tried the above example and it does not work.
thanks for all the replies
Kamaraju S Kusumanchi