blog-image

May 15, 2017

7 min read

Remote Linux desktop on your VPS with SSH and VNC

Written by

Vippy The VPS
While you usually connect to your VPS via a terminal, you can also connect to a remote Linux desktop via SSH or VNC to run desktop GUI apps. There are a number of ways to get this done, from running single commands via X11 forwarding and ssh, to forwarding an entire desktop, to using VNC. In this tutorial, we’ll cover how to do each of these so that you can choose the application that works best for your needs. Note: We can’t guarantee these operations will be particularly fast—primarily due to latency between your machine and your VPS—but it could come in handy every once in awhile.

Prerequisites

  • A VPS running any of our available OS options.
  • A non-root user account (commands requiring escalated privileges will use sudo).
  • A local machine running Linux, an OS X machine with XQuartz installed, or a Windows machine with Xming installed—this tutorial depends on having some type of X server running locally.
    • Windows users should install Xming.
    • OS X users should install XQuartz.
    • Once Xming/XQuartz are installed, you can then launch an xterm or other terminal to ssh into your VPS and enable X11 tunneling.
[cta_inline]

Forwarding single X applications

To forward a remote Linux desktop running on your VPS, which allows you to view X applications on your local machine, you should connect via ssh using the -X option, which enables X forwarding, and the -C option, which enables data compression.
$ ssh -XC user@IP-ADDRESS
Once into the VPS, you should first install the xauth package.
$ sudo apt install xauth             # Debian/Ubuntu
$ sudo yum install xorg-x11-xauth    # CentOS
Then, open /etc/ssh/sshd_config with your favorite editor and look for the X11Forwarding option. This line should be uncommented and be changed to X11Forwarding yes. After that, you should restart
Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.

Leave a Reply