I am looking for way to connect to Linux machine without connecting to it using SSH, Telnet or something similar. The Linux machine is behind a router and I don't have access to it. So opening / closing some ports is not an option. The solution which I am looking for must not use incoming ports. Maybe some socket or I don't know. I can initiate a connection from that machine.
-
Everything uses ports. Can you initiate the connection from that machine? – yellowantphil Apr 09 '16 at 03:15
-
Yes, it should be possible. – ValeriRangelov Apr 09 '16 at 03:22
-
If you can open a connection from that machine and leave it open, then you can access it from the other end of the connection anytime you want. You wouldn’t have to open any ports on your router, because the connection was opened from the inside. I have never done that, and I don’t know how exactly. – yellowantphil Apr 09 '16 at 03:24
-
I also don't know how to do that. – ValeriRangelov Apr 09 '16 at 03:30
-
1Maybe use a reverse tunnel: initiate ssh connection from server to client – yellowantphil Apr 09 '16 at 03:33
-
1You could use something like TeamViewer to have your Linux box open a tendril to a centralized location, and then use the same program externally to get into your machine. You could have your Linux box maintain a connection to a VPN. You could use Chrome's Remote Desktop plugin. There are several options. – DopeGhoti Apr 09 '16 at 04:35
2 Answers
If a network connection is possible from the remote machine to your local machine. You can:
Setup a tunnel using SSH -R
from remote-to-local, then use that tunnel to SSH from local-to-remote. See initiate ssh connection from server to client, as suggested above by amarillo.
If networking isn't an option, you can still use:
Enable serial console, i.e login to your system over serial cable (typically RS232). Pull a serial cable between two servers on each side of the router. See Gettys on Serial Consoles (with systemd), or Ubuntu's SerialConsole wiki page
Use a networked Keyboard-Video-Mouse switch (known as KVM over IP). This IPKVM device should be attached to the USB & VGA connector of the remote server on one side and it should be connected to the network on your side of the router. That device let you control the remote keyboard and mouse to control and view what's happening (streaming the video).

- 3,021
If you want networking, but do not want to use any ports (I assume this means IP ports and e.g. serial port), then you have to use a protocol that does not use ports. You can use ICMP and Ping Tunnel to forward telnet or ssh through it, or 6to4 (which is assigned its own protocol type 41 and is port-less), or similar measures.
While this answers the question, it might be quite possible that these protocols are blocked as well, and it goes without saying that such measures should not be deployed unless in very unusual situations (maybe with the exception of 6to4).

- 1,853