How to use Jetbrains Gateway with WSL?

4 July 2022

Table of content


This setup was tested on Ubuntu 22.04 but for other distributions it might be slightly different. The idea should remain the same.

Installing SSH

Jetbrains Gateway will use SSH to connect to the Windows subsystem so you need to ensure you can connect to it via SSH. For that, simply open a terminal and connect to your WSL and type the following:

sudo service ssh status

If for some reason SSH is not yet installed, you need to install it:

sudo apt-get install openssh-server

If SSH is not yet started you need to start it:

sudo services ssh start

If you try again to connect using ssh localhost you should receive a Permission denied (publickey). message. You need to make sure SSH allows for an authentication with a password. Edit /etc/ssh/sshd_config with your favourite editor:

sudo vi /etc/ssh/sshd_config

And search for PasswordAuthentication and make sure it is configured to yes. Save the file and exit the editor. Note that you can also connect using a pair of SSH keys but I don’t cover that here.

Restart the SSH server:

sudo services ssh restart

At this point, if you type ssh localhost again and you receive this error message sshd: no hostkeys available -- exiting then you need to add the hostkeys to your SSH folder:

sudo ssh-keygen -A
sudo services ssh restart

And that’s it. You should now be able to connect to your WSL using SSH. Note that from a Windows command line you can use localhost as well.

Running Jetbrains Gateway

The next step is to install Jetbrains Gateway and then connect. You’ll need to create a new connection using localhost and the user you are using in WSL and provide Gateway with your password. The last step is about selecting, on the remote system, the location of your code.

After that Jetbrains Gateway will install the client IDE on the remote system and start your IDE from there.