1

Looking for a way to see a couple of PLC units behind a 4G router here in Australia I came across a post using Autossh a Raspberry Pi and tunneling. What a great concept. I have used tunneling quite successfully for years

Bought my first Pi and set it up on the bench at home.

It did its thing.

Took the PI to the workshop, plugged it in to the network, got home to see it polling and getting rejected at my firewall as expected. Opened up port 22 from that one address. WOW. Yep can tunnel back into the pi.

I dont normally have port 22 open as a rule and use non standard ports for my SSH and this is where I seem to run into problems. I cannot find how I get Autossh to use something other than port 22 for the middleman connection.

As my last parameter of my autossh line I have user@somewhere.com

I have tried user@somewhere.com:port

and user@somewhere.com -p port

But neither of these seem to work. Unsure if I have it incorrect or if the ports I have tried are blocked in the route to my base system.

Can someone that uses unusual ports point me in the correct direction please?

4
  • Did you also try -p someport user@somewhere.com so, reversing your last experiment? :)
    – madeddie
    Aug 11 '16 at 18:11
  • No not as yet as I changed to the last one as I was on way to work. Will have to give that a go
    – secs
    Aug 11 '16 at 19:40
  • autossh just feeds all the flags except -f and -M to the underlying ssh execution. to ssh to a specific port you use the -p port, but ssh also wants you to put flags like that before the host (or in this case, username@host combo), so, i think you were close, but expecting more intelligence of autossh :)
    – madeddie
    Aug 11 '16 at 19:49
  • Yes that appears to have worked. Thanks heaps.......
    – secs
    Aug 12 '16 at 4:12
6

autossh feeds all the flags except -f and -M to the underlying ssh execution.

To make autossh connect to a specific port on the ssh server you do need to use the -p port, but ssh also wants you to put flags like that before the host (or in this case, username@host combo).

So it becomes

autossh [autossh options] -p someport user@somewhere.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.