Reverse SSH
So once in a while I'm working remotely on a project where I'm at a different location then where the PC/Mac is situated. There are plenty of tools which are pretty good with remote desktop, though when the bandwidth is limited it's sometimes more pleasent to login using SSH to update the remote code, or compile your application. But when the remote PC is behind a firewall you'll need the other party to correctly forward the SSH port to their IP. When this is not possible you can ask the remote party to start the SSH connection for you, so that you can login withouth them having to change their router.
Basically what you need to create is a reverse SSH connection, where the computer onto which you want to login initiates the SSH tunnel.
But before this to work, make sure that you have an account on the computer onto which you want to login, and that the remote user has an account on your computer.
1. First create the necessary accounts
On the remote computer, the one onto which you want to login, ask the
user to create an account for you, if they didn't already do that. On
Mac you can do that through the System Preferences > Users. Make it a
standard account.
2. Make sure that SSHD is running on both computers
On linux you need to install the appropriate package and on Mac
you need to enable Remote Login, which you can find in System Preferences >
Sharing > [x] Remote Login.
Make sure that your public is configured correctly to allow SSHD connections
3. Let the remote user initialise the SSH tunnel
This simply means that you ask someone at the remote location to type a command like:
ssh -4 -R 5900:localhost:22 account_for_remote_user_on_your_pc@the_public_ip_of_your_pc.com
Example:
- My public IP: 84.105.186.000
- Account for remote user on my PC: joel
ssh -4 -R 5900:localhost:22 joel@84.105.186.000
The remote user will be asked to enter a password, and after entering he will be logged in into your computers. It mail feel strange that the remote user needs to login... but apparently that's how it has to work.
4. Connected to the created tunnel
Once the remote user has logged in, onto your PC/Mac you can connect to the created tunnel. You can do that by connecting to the tunnel at localhost with the port we just used (5900). So on your PC/Mac, type something like the following:
ssh -p 5900 an_existing_account_on_your_computer@localhost
Summary
Here "joel" is the remote user who will initialise the SSH and you connect to the remote through a local port 5900 as user roxlu. The remote PC needs to have the account roxlu.
Remote:
ssh -4 -R 5900:localhost:22 joel@84.105.186.000
Local:
ssh -p 5900 roxlu@localhost
NAT Types
Building Cabinets
Compiling GStreamer from source on Windows
Debugging CMake Issues
Dual Boot Arch Linux and Windows 10
Mindset Updated Edition, Carol S. Dweck (Book Notes)
How to setup a self-hosted Unifi NVR with Arch Linux
Blender 2.8 How to use Transparent Textures
Compiling FFmpeg with X264 on Windows 10 using MSVC
Blender 2.8 OpenGL Buffer Exporter
Blender 2.8 Baking lightmaps
Blender 2.8 Tips and Tricks
Setting up a Bluetooth Headset on Arch Linux
Compiling x264 on Windows with MSVC
C/C++ Snippets
Reading Chunks from a Buffer
Handy Bash Commands
Building a zero copy parser
Kalman Filter
Saving pixel data using libpng
Compile Apache, PHP and MySQL on Mac 10.10
Fast Pixel Transfers with Pixel Buffer Objects
High Resolution Timer function in C/C++
Rendering text with Pango, Cairo and Freetype
Fast OpenGL blur shader
Spherical Environment Mapping with OpenGL
Using OpenSSL with memory BIOs
Attributeless Vertex Shader with OpenGL
Circular Image Selector
Decoding H264 and YUV420P playback
Fast Fourier Transform
OpenGL Rim Shader
Rendering The Depth Buffer
Delaunay Triangulation
RapidXML
Git Snippets
Basic Shading With OpenGL
Open Source Libraries For Creative Coding
Bouncing particle effect
OpenGL Instanced Rendering
Mapping a texture on a disc
Download HTML page using CURL
Height Field Simulation on GPU
OpenCV
Some notes on OpenGL
Math
Gists to remember
Reverse SSH
Working Set
Consumer + Producer model with libuv
Parsing binary data
C++ file operation snippets
Importance of blur with image gradients
Real-time oil painting with openGL
x264 encoder
Generative helix with openGL
Mini test with vector field
Protractor gesture recognizer
Hair simulation
Some glitch screenshots
Working on video installation
Generative meshes
Converting video/audio using avconv
Auto start terminal app on mac
Export blender object to simple file format