Use a control socket to share an authenticated connection among multiple processes:
ssh -fNM -S ~/.ssh/sock otheruser@host # Will prompt for password, then exit
...
ssh -S ~/.ssh/sock otheruser@host command1
ssh -S ~/.ssh/sock otheruser@host command2
...
ssh -S ~/.ssh/sock -O exit otheruser@host # Close the master connection
See man ssh_config
, under the ControlPath
option, for information on how to create a unique path for the control socket.