I have three devices, school, home and portable. I will hereon refer to them as S, H, and P. I want to be able to use P to run command and fetch files on H through the internet, but home has no public ip.

Now, S does have a public ip, ssh, and an exposed port 22. I can tunnel to S from anywhere. However, when I run

ssh -R 53469:localhost:22 school

at home (53469 is just a random unused port), and then

ssh school -p 53469

I am not able to connect: only port 22 is exposed at school.

So what I ended up doing was some sort of double-tunneling, using school as some sort of a rendezvous point. At home, I ran the reverse-tunneling command above. Then I used portable to tunnel to school, and then tunnel home via localhost:53469. Then this weird thing happens:

After running (on portable)

ssh school -p 22

and then

ssh localhost -p 53469

in the tunneled session, I end up back in school.

Pressing Ctrl+D the first time gets me back to home (which is where I want to be). The second time gets me to school again. The third time returns me to portable.

What is happening here? Am I running some sort of script that tunnels me for the third, extra time?

Here's the lsb_release information:


me@home:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:    16.10
Codename:   yakkety


me@school:~>lsb_release -a
LSB Version:    core-5.0-amd64:core-5.0-noarch:desktop-5.0-amd64:desktop-5.0-noarch:imaging-5.0-amd64:imaging-5.0-noarch:languages-5.0-amd64:languages-5.0-noarch
Distributor ID: openSUSE project
Description:    openSUSE Leap 42.3
Release:    42.3
Codename:   n/a

Your Answer

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

Browse other questions tagged or ask your own question.