Login via ssh to last used folder
I suppose you are using bash as shell.
edit .bash_logout in you home dir, add a line like
pwd > $HOME/.last-pwp
edit .bash_profile, add a line like
cd $(< $HOME/.last-pwp )
note that if you run many session in parallel, only one directory will be remembered.