There are a variety of scripts one can come up with.
See the ssh-agent(1) man page. Ask me if you want

An insane way to do this is to tunnel term(1)
thru the ssh link. I actually do this and then the script
is simply "trsh rsh <somehost>". Term was a great
program in its day. I believe am the last person using it...