0

I have an IoT device I'm working on. I need to be able to reliably SSH into it once it's out in the field since I won't have physical access if I need to modify any files. I have a startup script that uses the following line to open an SSH tunnel:

sshpass -p 'XXXXXX' ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -fN -R 7000:localhost:22 user@server-address.com

This is successful at opening a tunnel, but if power is interrupted I can no longer open a tunnel without changing port number.

Here is the output with -vvv:

debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug3: no such identity: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: packet_send2: adding 48 (len 61 padlen 19 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

I'm running Debian on an Intel Edison.

2 Answers2

0

I eventually duct-tape-coded this into submission with an endless loop that just tries over and over. Not sure why this works, but I sure as hell won't find out from this website.

And since my reputation isn't high enough to post on meta...

To future people with this question: Every time I come here and find questions on my issue, the question is either downvoted to hell with no answers or all the comments are just mean in general. Stuff like "why bother doing that" or "duplicate" (when its clearly not) aren't helpful. I tried asking questions myself hoping for better responses, but got none. Screw this site, Reddit is more helpful.

0

Looks like your older tunnel are still utilizing connection on port 22 and that's why you can't establish connection again.

You can fix that by provide SSH session timeout on the server side in the sshd.conf file:

ServerAliveInterval 30

You need to be sure that your device boot time is more that this number!

Take a look here for more details.

Tim Connor
  • 97
  • 2