For X11 forwarding, do both the local and remote systems have to run an X server?

Can I do X11 forwarding if my remote machine is in: runlevel 3, meaning that no X server is running?

  • 5
    1. no ; 2. yes (why haven't you tried? faster than asking) – Ipor Sircer Nov 29 '16 at 10:02
  • Can you please explain both the points a little as i am with very limited environment. If possible provide the link for more info. – Rajnish Kumar Soni Nov 29 '16 at 12:45
  • An X Server manages a display. – waltinator Nov 30 '16 at 0:10
  • @Serge Don't do that – Michael Mrozek Nov 30 '16 at 16:03

You only need to run the X server on your client PC where you want see the GUI/Desktop. Typically this would be on your Windows PC in most environments ofcourse you could run it on a Linux/Mac workstation to. Point is the X Server itself must run on the client pc. The Linux server needs SSH along with the X Window System installed from packages, usually it is by default. The best client software I've seen to do this is MobaXTerm. MobaXTerm is a terminal client that runs an X Server on your client PC. The cool thing about MobaXTerm is it does the X Server for you along with exports the variables when you ssh to a server, it usually just works.

A tip though, if you login to a server using a terminal client such as MobaXTerm if you su, sudo, and/or switch users you loose the environment variable named DISPLAY=hostname:X.X which is required for this to work.

To install X Window software on Linux server at least CentOS/RHEL environments, others are probably similar you can check for the following.

 yum groupinfo "X Window System"
 yum groupinstall "X Window System"

Then update /etc/ssh/sshd_config to enable X11 Forwarding for SSH then restart your sshd service.

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.