Ubuntu – ssh without opening the ports

ssh

I usually provide solutions for my friends for fixing issues on their ubuntu machines. Most of them use shared internet connection over LAN where they cannot open ports for allowing me access their machines over ssh. Is it possible to ssh into a machine without opening ports. For example services like Teamviewer allow users to just accept a connection request from outside, and if the owner of the machine permits, then the machine can be used by authenticated users. So, similarly, if the owner of the machine permits, with some kind of authentication, one should be able to get ssh access to a machine without opening the ports on the NAT router.

Best Answer

You can do this over Empathy's backend (telepathy) through another application called ssh-contact.

I haven't used it personally, but it seems to me like a good way of getting two novices to SSH into each other.


Of course another method would be to have them SSH to you (I assume you're competent enough to manage your port forwarding) and forward a port back to a ssh server on their machine.

Get them to run:

ssh -R 48724:localhost:22 your_username@your_ip

You obviously might not want them logging in as your user so you could create another user and have that just for SSHing. There obviously has to be a modicum of trust between you and the other user.

And then you run:

ssh -p 48724 their_username@localhost

I'm using a high port so root privileges aren't required.

Of course, they'll need openssh-server installed for you to connect but that's a simple sudo apt-get install openssh-server