- First, you need to install Cygwin/X packages as below:
- In your Vagrantfile, add the following:
Vagrant.config(2) do |vb|
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
reboot your vagrant box by running ‘vagrant reload’
- In your vagrant box, install xauth ‘sudo yum install -y xauth’ (assume you are using CentOS)
- Start X Server in Cygwin:
startxwin — -multiwindow -listen tcp &
- Pay attention to the output of startxwin, set up DISPLAY environment variable in Cygwin, ex. ‘export DISPLAY=’localhost:0.0’
- In your Vagrant box, make sure /etc/ssh/sshd_config has ‘X11Forwarding yes’ set up.
- Run a GUI app in Vagrant box such as:
ssh -Y -p 2222 -i vagrant@localhost xclock
(You need to make sure your private key has a mode of 600)
if you get error ‘Permission denied (publickey,gssapi-keyex,gssapi-with-mic)’, you need to make sure ‘config.ssh.forward_agent=true’ is added to your vagrant file and ‘Vagrant reload’ is executed.