-
Notifications
You must be signed in to change notification settings - Fork 2
SSH
- ssh to destination server through jump server in one session of WSL.
- 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.
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!
https://www.cyberciti.biz/faq/how-to-fix-x11-forwarding-request-failed-on-channel-0/
- 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
- SSH Server
Remote /etc/ssh/sshd_config.
X11Forwarding yes X11UseLocalhost no # Turn it on for passwd-less login using ed25519 and rsa etc. PubkeyAuthentication yes # Default is INFO LogLevel DEBUG
To make the changes take effect.
# kill -SIGHUP $(pgrep -f "sshd -D") Or # service sshd reload
- Debug on the client side
$ ssh -X -v -v -v user@ip
The client can’t login with rsa, ed25519 etc. And turn on the LogLevel to DEBUG in sshd_config, found sth. like,
# tail -f /var/log/secure <snipped> ...sshd[52581]: debug1: Could not open authorized keys '/data/home/zedware/.ssh/authorized_keys': Permission denied <snipped>
This comment from https://stackoverflow.com/questions/20688844/sshd-gives-error-could-not-open-authorized-keys-although-permissions-seem-corre saved the day.
I had the same problem with the same cause, but restorecon didn't work. I had to change the SELinux type explicitly. chcon -Rv -t ssh_home_t ~/.ssh – Jonathan
The non-default home path and selinux caused the problem.
Install OpenSSL and register it as an automatic task in Windows, https://www.illuminiastudios.com/dev-diaries/ssh-on-windows-subsystem-for-linux/.
Created by Wenliang Zhang.