Skip to content
William Zhang edited this page Jan 15, 2019 · 2 revisions

SSH tunnel

  1. ssh to destination server through jump server in one session of WSL.
  2. create tunnel in another session of WSL.
$ ssh -NL 127.0.0.1:8000:remote:8000 -p 22 public@jump
public@jump's password:

Local 8000 is now mapped to destination server’s 8000.

SSH on VM

Make sure it is the correct distribution and version wanted. (CentOS 7.x, Ubuntu 18.04, etc.)

If the default ssh port is not 22, so make sure to access it with:

$ ssh -p <port> user@host
$ scp -P <port> from@host1:/foo user@host2:/baro

Look the case of the letter p/P!

SSH and X11

https://www.cyberciti.biz/faq/how-to-fix-x11-forwarding-request-failed-on-channel-0/

  1. WSL Linux

Local /etc/ssh/ssh_config.

 19 Host *
 20     ForwardAgent yes
 21     ForwardX11 yes
 22     ForwardX11Trusted yes
...
 49     SendEnv LANG LC_*
 50     HashKnownHosts yes
 51     GSSAPIAuthentication yes
 52     XauthLocation /usr/bin/xauth
  1. SSH Server

Remote /etc/ssh/sshd_config.

X11Forwarding yes
X11UseLocalhost no

# service sshd reload
  1. Debug
$ ssh -X -v -v -v user@ip 

SSH server on WSL

Install OpenSSL and register it as an automatic task in Windows, https://www.illuminiastudios.com/dev-diaries/ssh-on-windows-subsystem-for-linux/.

Clone this wiki locally