I am rather new to linux and have a CentOS box to play with. I am quite comfortable with the command line, but one thing that bugs me is that unless, someone is logged in to the GUI and has vnc enabled, I can't access it from a remote location. Even then, I must use the GUI as the user that is logged in. What if I wanted to logout and login as a different user in GUI ? Basically what i'm asking is, is there a way to remotely "log in" to a linux gui as done with windows remote desktop as opposed to just desktop sharing via vnc?

  • 1
    Use a different VNC server. Some vnc servers share a desktop, others have a unique session for each login. I think x11vnc will work. The reason everyone is suggestiong ssh is that VNC servers are insecure and one of the most common cracks. So use ssh -X or FreeNX. FreeNX is by far the fastest and most secure vnc server (IMO).
    – Panther
    Jun 18 '14 at 20:05
  • You are logging in to the existing GUI as is done with Windows RDP. What you want to do is the opposite, to run your own GUI remotely — and that is what normally happens on Linux. You aren't saying what you're doing, but it seems that you're using some software that sets up a Windows-like model. Using just about anything else will give you the Linux my-session-is-my-session model. Jun 18 '14 at 22:40
  • @bodhi.zazen thanks for the heads up. I assumed the default vino package has all the functionalities, didn't know the proper way to set up a full fledged vnc server. Like I said, i'm a n00b. Now I have configured tigervnc with three users and they can connect using their respective display no. and password. But my doubt is, what If i'm running a network authentication service like ldap and don't know which user is going to log in ? Am I supposed to create displays and vncpasswd for all of them ? Jun 19 '14 at 9:43
  • Yes, you create a separate display and password for each user. Be sure to use STRONG PASSWORDS.
    – Panther
    Jun 19 '14 at 13:23

You can SSH into the box remotely, and then launch your own VNC session. VNC on Linux works as an entire replacement for an X-server, so multiple users can run multiple VNC sessions, each with their own display workspace.


If you want similar behaviour and even use your normal RDP-client, you could just install xrdp. For CentOS, it should be sufficient to do yum install xrdp

  • Exactly what I was looking for. Thanks a lot. Jun 20 '14 at 9:47

You can use the X11 desktop forwarding feature.

To do so, first install the SSH server on the target machine (that will allow encrypted connection; it is possible to do it without SSH, but it's very dangerous as data is sent in clear text) and enable the X11 forwarding in /etc/ssh/sshd_config:

X11Forwarding yes

Now you can initiate a graphical connection to the target machine with the following command:

ssh -X -C username@target_machine_hostname

The -C flag is not required, it compresses data to reduce network load. So if you have a lot of bandwidth or slow CPU, you can leave it.

  • 2
    x11 forwarding will enable running x applications from the remote machine, but I want the complete gnome desktop environment from a remote location without physically logging in and sharing desktop on the linux box. Jun 18 '14 at 14:01
  • This is the most common way I've seen to work on a server or calculation cluster in bioinformatics. Just observe that if a command is being executed and your connection stalls, the command will be interrupted. To avoid that you can use terminal multiplexers like tmux (to be installed) or screen (already installed).
    – 3nrique0
    Jun 18 '14 at 14:01
  • I used this command and it went through. However on the target machine I an at the cli and no GUI. I have XForwarding on the target machine. Aug 18 '21 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.