|
|
(One intermediate revision by the same user not shown) |
Line 43: |
Line 43: |
| Now connect to SSH server using '''-X''' argument : | | Now connect to SSH server using '''-X''' argument : |
|
| |
|
| <pre>ssh username@hostname -X</pre> | | <pre>ssh username@hostname -XY</pre> |
|
| |
|
| X11 forwarding is now enabled on Powershell. | | X11 forwarding is now enabled on Powershell. |
|
| |
| ==WSL==
| |
|
| |
| Windows Subsystem for Linux (WSL) is a feature of Windows that allows developers to run a Linux environment without the need for a separate virtual machine or dual booting.<br />
| |
| There are two versions of WSL: WSL 1 and WSL 2. WSL 1 was first released on August 2, 2016, and acts as a compatibility layer for running Linux binary executables (in ELF format) by implementing Linux system calls on the Windows kernel.
| |
|
| |
|
| |
| ===Prerequisites===
| |
|
| |
| *Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
| |
|
| |
| ===WSL Configuration===
| |
|
| |
| *Start an elevated terminal by pressing on Windows key + X and choose terminal (admin) then type the following command :
| |
|
| |
| <pre>wsl --install</pre>
| |
|
| |
| This command will install all needed components for WSL and '''Ubuntu 22.04 distribution''' by default.
| |
|
| |
| ''if you prefer another distribution you can specify it with the -d argument ([[#Install another distribution|more info at the end of this section]]).''
| |
|
| |
| *'''After the configuration is completed you need to restart your computer.'''
| |
|
| |
| *After having restarted your computer you need to specify a username and a password then your WSL Distribution is ready to use.
| |
|
| |
| *To connect over SSH with X11 forwarding use the -X argument in your SSH command :
| |
|
| |
| <pre>ssh username@hostname -X</pre>
| |
|
| |
| ===Install another distribution===
| |
|
| |
| You ca use the -d argument to specify another distribution to be installed by WSL, use the following command to get the distribution that are available :
| |
|
| |
| <pre> wsl --list --online</pre>
| |
|
| |
| At the time of writing this documentation the following distribution can be installed using WSL :
| |
|
| |
| <pre>
| |
| NAME FRIENDLY NAME
| |
| Ubuntu Ubuntu
| |
| Debian Debian GNU/Linux
| |
| kali-linux Kali Linux Rolling
| |
| Ubuntu-18.04 Ubuntu 18.04 LTS
| |
| Ubuntu-20.04 Ubuntu 20.04 LTS
| |
| Ubuntu-22.04 Ubuntu 22.04 LTS
| |
| OracleLinux_8_5 Oracle Linux 8.5
| |
| OracleLinux_7_9 Oracle Linux 7.9
| |
| SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
| |
| openSUSE-Leap-15.4 openSUSE Leap 15.4
| |
| openSUSE-Tumbleweed openSUSE Tumbleweed
| |
| </pre>
| |
|
| |
| For example to install Debian use the following command :
| |
|
| |
| <pre>wsl --install -d debian</pre>
| |
|
| |
| [https://learn.microsoft.com/en-us/windows/wsl/install| More information]
| |
Latest revision as of 13:16, 8 November 2023
This page explain the procedure to enable X11 forwarding with SSH on Windows 10 & 11 using Powershell or WSL.
Powershell
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language.
Since version 5.1 Powershell includes open-ssh utility allowing user to use it to connect to SSH without the need of a third party software.
Prerequities
- A device running at least Windows Server 2019,Windows 10 (build 1809) or later.
- PowerShell 5.1 or later.
Creating SSH keypair
Start Powershell using shortcut windows key + X, then type the following command to create your key :
ssh-keygen -t ecdsa
Follow the steps to create your ECDSA SSH keypair.
Once the key are generated you need to install Xming
Installing Xming
Get the installer from this page, then install it.
Note that you can install Xming using Chocolatey :
choco install xming -y
Ensure Xming is started before continuing.
Enabling x11 forwarding
Start Powershell and paste the following command :
$env:DISPLAY= 'localhost:0.0'
(you need to type this command each time before using x11 forwarding.)
Now connect to SSH server using -X argument :
ssh username@hostname -XY
X11 forwarding is now enabled on Powershell.