Factor SSH session creation for usage in SCP and remote shell