Score:0

How can I have ssh access to multiple machines using ngrok?

de flag

I've got a couple machines that are often either up or down. When they're up, I want ssh access to them using ngrok. I've set up ngrok on both machines, and their config files look like this:

authtoken: <AUTH_TOKEN>
  tunnels:
    ssh_tunnel:
      proto: tcp
      remote_addr: 3.tcp.ngrok.io:<PORT>
      addr: 22
  version: "2"
  region: us

where <PORT> is different on each machine. I've also got the TCP addresses in ngrok and they show up as "online" when the the corresponding machine is turned on.

My problem is reliably connecting to the machine I want. SSH seems to be unable to distinguish between the two machines when I run this command:

ssh <USER>@3.tcp.ngrok.io -p <PORT>

Often times it automatically connects to a machine I had recently ssh'd into, even though I specified a different port than the one it is running on. I'm occasionally able to remedy this by clearing ~/.ssh/config and ~/.ssh/known_hosts but even this doesn't seem to be a reliable way to get to the machine I want.

What am I doing wrong? Why is ssh not respecting the specified port? Is ngrok sending my requests to the wrong location?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.