Configuring WSL as a ControlMaster relay server: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
=== Install additional packages === | === Install additional packages === | ||
<pre> | |||
sudo apt update && sudo apt upgrade -y | sudo apt update && sudo apt upgrade -y | ||
sudo apt install openssh-server -y | sudo apt install openssh-server -y | ||
NOTE: you may login from Windows to Ubuntu with: ssh localhost | |||
</pre> | |||
=== General ideal of the setup === | === General ideal of the setup === | ||
<pre> | <pre> | ||
Line 40: | Line 43: | ||
</pre> | </pre> | ||
=== | === Customize .ssh/config on ubuntu === | ||
<pre> | <pre> | ||
jaime@ubuntu:~$ cat .ssh/config | jaime@ubuntu:~$ cat .ssh/config | ||
Line 49: | Line 52: | ||
HostName cedar.computecanada.ca | HostName cedar.computecanada.ca | ||
User pinto | User pinto | ||
</pre> | |||
=== Configure your customer authorized_keys === | |||
<pre> | |||
jaime@ubuntu:~/custom_ssh$ cat /home/jaime/custom_ssh/authorized_keys | |||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHSRvqzlffkzcjRAaMQoTBrPe5FxlSA6cQ0v3yVzN+A+ | |||
NOTE: use the same public ssh key that you uploaded to CCDB | |||
</pre> | |||
=== Now start the sshd server on 'ubuntu' === | |||
<pre> | |||
jaime@ubuntu:~/custom_ssh$ /usr/sbin/sshd -f ${HOME}/custom_ssh/sshd_config | |||
NOTE: make sure your start the server as yourself, now as root. | |||
</pre> | |||
=== Customize .ssh/config on smart RemoteCommand === | |||
<pre> | |||
jaime@smart ~/.ssh cat config | |||
Host ubuntu | |||
Hostname localhost | |||
RemoteCommand ssh cedar | |||
jaime@smart ~/.ssh | |||
</pre> | </pre> |
Revision as of 17:58, 22 March 2024
Disclaimer: This is still and experimental procedure (work in progress). Your feedback is welcome.
How to install Linux on Windows with WSL[edit]
- Please follow this link for more detailed instructions
https://learn.microsoft.com/en-us/windows/wsl/install
- this setup assumes the following:
* you selected Ubuntu as your distro of choice * the hostname for the WSL instance is 'ubuntu' edit /etc/hostname (ubuntu) and /etc/hosts (127.0.0.1 localhost ubuntu) * the Windows system is named 'smart' and my login name is 'jaime' * the user name on the ubuntu VM is also 'jaime' * the Alliance user name is 'pinto' and I want to connect to 'cedar'
Install additional packages[edit]
sudo apt update && sudo apt upgrade -y sudo apt install openssh-server -y NOTE: you may login from Windows to Ubuntu with: ssh localhost
General ideal of the setup[edit]
[ssh client] ----> [ssh relay server] ----> [ssh target server] your Windows modified authorized_keys target machine machine in your Ubuntu VM using cedar 'smart' 'ubuntu' 'cedar'
Login to the ubuntu VM and create a custom_ssh folder[edit]
jaime@ubuntu:~$ cat custom_ssh/sshd_config Port 2222 HostKey /home/jaime/custom_ssh/ssh_host_ed25519_key HostKey /home/jaime/custom_ssh/ssh_host_rsa_key AuthorizedKeysFile /home/jaime/custom_ssh/authorized_keys ChallengeResponseAuthentication no UsePAM no #UsePrivilegeSeparation no Subsystem sftp /usr/lib/openssh/sftp-server PidFile /home/jaime/custom_ssh/sshd.pid NOTE: you may copy the ssh_host keys from /etc/ssh
Customize .ssh/config on ubuntu[edit]
jaime@ubuntu:~$ cat .ssh/config Host cedar ControlPath ~/.ssh/cm-%r@%h:%p ControlMaster auto ControlPersist 10m HostName cedar.computecanada.ca User pinto
Configure your customer authorized_keys[edit]
jaime@ubuntu:~/custom_ssh$ cat /home/jaime/custom_ssh/authorized_keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHSRvqzlffkzcjRAaMQoTBrPe5FxlSA6cQ0v3yVzN+A+
NOTE: use the same public ssh key that you uploaded to CCDB
Now start the sshd server on 'ubuntu'[edit]
jaime@ubuntu:~/custom_ssh$ /usr/sbin/sshd -f ${HOME}/custom_ssh/sshd_config NOTE: make sure your start the server as yourself, now as root.
Customize .ssh/config on smart RemoteCommand[edit]
jaime@smart ~/.ssh cat config Host ubuntu Hostname localhost RemoteCommand ssh cedar jaime@smart ~/.ssh