How to enable X11 Forwarding in windows 10 on a Vagrant Virtual Box Running Ubuntu

John Cook
4 min readJan 31, 2020

--

So first you will need a Vagrant Virtual Box Running Ubuntu. This tutorial will not cover how to do this as there are adequate tutorials else where that explain how to do so.

Second you will need to open your /etc/ssh/ssh_config file on your Ubuntu machine and enable Forwardx11. You can do this by typing in: “nano/etc/ssh/ssh_conf”. When you are done with the file it should look something like this:

ssh_conf

Next you will need download and install Putty on your host Windows 10 machine. Once this is done you will need to set up Putty, follow the default installation instructions. Now we will need to give Putty your Vagrant ssh key, to do this got to the folder you installed Putty in and run “puttygen.exe” it is usually found in the following path: “C:\Program Files\PuTTY” it is case sensitive.

Next hit the load button:

Then select the “All Files” option:

Then navigate to your virtualbox folder the default path is: “C:\Users\user_name\.vagrant\machines\default\virtualbox” select the file “private_key” and hit “OK” when the prompt appears. Then save the private key and name it whatever you would like, I named mine “putty_private_key”, make sure that RSA is selected and the number of bits is 2048.

Now open a cmd prompt and type in “vagrant ssh-config” this will give you the information you need to put into Putty.

You will need to save the following information in putty so write it down somewhere. The HostName(127.0.0.1), the port(2222), and the User(vagrant). Now go to putty and enter the HostName and port, making sure that the connection type is SSH:

Next in Putty got to Connection->Data and enter the User into Auto-login username:

Finally go to Connection->SSH->Auth and browse for the private key you made with the key gen tool:

Now go to Connection->SSH->Auth->X11 and hit Enable X11 forwarding:

Now navigate back to Session and Save your session:

Once done click open and say yes to the prompt.

Now you will need to download and install Xming on Windows. This is a server that allows Windows an Ubuntu to share things graphically. Xming will need to be running in order to render anything, you can tell if its running by checking for its icon in the icon arrow on the task bar usually located one the bottom left of your screen:

Now on your Ubuntu you will need to install the following:

sudo apt-get install xorg
sudo apt-get install openbox

once done you should be all set. Try typing in xclock to the Ubuntu machine to test if it is working.

So to review, you must first enable X11 forwarding in Vagrant, then install and setup Putty on Windows. Then install Xming on Windows. Then install xorg and openbox on Ubuntu. If you open a session with Putty and have Xming running you should now be able to render things from your Ubuntu machine to Windows. I hope that this guide has been helpful and I would like to thank the following two Youtube videos for helping me figure this out, if you are stuck I would watch these videos as they do a better job of explaining things then I do:

--

--

No responses yet