I would suggest to use an ssh-key to log in. Running an ssh agent in the background would even allow to connect to several machines after you entered the passphrase once.
Then an ssh tunnel created by the option -L
could give you access to a secondary machine behind a gateway and by using agent forwarding the same already enabled ssh-key (something like: “ssh -L 1234:server2:22 server1 &” and then “ssh -p 1234 localhost”).
A good Howto