Break Out of the Virtualbox Jail: Run Linux Graphical Apps On Windows Using Putty, Xming, and VirtualBox
I use Virtualbox to run linux. But the terminal Virtualbox uses is awful so I ssh in when I want to use the command line. I recently discovered you can also do this for the graphical desktop so you don’t have to put up with the lousy Virtualbox console which fits all the linux elements in a hard to scale box. You can have your graphical linux desktop run right along Windows just as it was another MS Window Window. Follow thiese steps:
- Download and install Xming Server on Windows.
- Setup your VirtualBox running say debian and boot up your virtual box ( I won’t go into that here but check this tutorial out).
- At your debian command line edit /etc/ssh/sshd_config and make these lines “yes”:
1X11Forwarding yesIf this doesn’t work, on some older versions of SSH you may also need to set “X11UseForwarding yes”. To make sure if you need this check “man sshd_config” if that option is available. If it is, either set it to yes or upgrade sshd (which is really what you should do!). If you use X11UseForwarding option and ssh refuses to start then you should delete it from the sshd_config.
- Restart your ssh server if X11Forwarding was previously set to no. On debian/ubuntu this would be
1sudo systemctl restart ssh.service
- If you don’t have a graphical desktop installed, install some sample programs:
1sudo apt-get install x11-apps - Now on your Windows desktop fire up Putty. Add a profile to ssh into your debian virtualbox machine (hint: if you haven’t already, you’ll need to get your virtual machine’s ip address and you can’t get that until you make sure your debian virtual machine’s network setting is set to bridge so it has an ip address on your local network. Follow the steps under Selecting Bridge Networking)
- In your Putty profile Go to X11 and make sure forwarding is turned on. Save your profile.
- Now, ssh in to your Virtualbox machine and start an x-windows app.
- You should see the eerie “xeyes” program staring at your right on your Windows desktop!:
That’s right, a Linux program running right on top of your local Windows desktop (actually the graphical elements are being forwarded by your virtualbox session to xming). Really cool and the Windows resizing and movements are unlimited by the Virtualbox Console. Try moving the window around – acts like any other Windows program. - For programs that require sudo you have to use the “-E” option:
1sudo -E gparted - Now you should see something like this – completely cool. I’ve labeled all the windows so you can appreciate the fact that the gparted GUI is running separately from the Putty and Virtualbox consoles:
And here’s a video:
1 |
xeyes |