How to tunnel remote UNIX socket on Windows machine
Asked Answered
H

1

7

On remote UNIX machine I have running MySQL on UNIX socket and I want to have a connection to this MySQL on my local Windows machine.

Previously I used next command that works on my Mac:

ssh -nNT -L 127.0.0.1:3307:<remote_socket_path> <remote_user>@<remote_ip> -p <remote_port>

On Windows I tried various tools like Plink and had no success, all of those tools expects host:port setup and doesn't recognize a socket path.

So what am I doing wrong and how I can tunnel remote socket like I'm doing it on Mac using SSH command?

Hydraulic answered 30/4, 2018 at 12:39 Comment(3)
FYI, forwarding unix domain sockets isn't a standard SSH protocol feature; it's an OpenSSH extension.Croix
OpenSSH is now part of Windows, I believe (read it at bleepingcomputer.com/news/microsoft/…). Can someone with access to a Windows box confirm whether it can forward to a UNIX socket path on the remote?Haricot
@Amir, it works. I can forward /var/run/docker.sock to Windows host via OpenSSH implementation of ssh client. Note, putty version of cli still doesn't support unix socket forwarding.Incorporate
H
2

Microsoft now ships a version of OpenSSH, which is the same implementation that is commonly found in desktop and server Linux and other UNIX installations, as part of Windows. As of the April 2018 Update of Windows 10, the same command that had worked on the Mac would work in a Windows CMD or Powershell:

ssh -N -L 127.0.0.1:3307:<remote_socket_path> -p <remote_port> <remote_user>@<remote_ip>

Plink, and possibly Putty for some use cases, are no longer necessary.

Haricot answered 31/12, 2019 at 21:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.