GDM can be configured to allow remote access via XDMCP (X Display Manager Control Protocol). We can use Cygwin-X or Exceed, to connect remotely to a server and get a complete desktop GUI.
Enabling XDMCP service
1. Edit the file /etc/gdm/custom.conf and make sure below parameters are added/set.
# vi /etc/gdm/custom.conf # GDM configuration storage [daemon] [security] DisallowTCP=false AllowRemoteRoot=true [xdmcp] Enable=true [greeter] [chooser] [debug]
2. Restart the gdm service.
For RHEL 6
# init 3 # init 5
For RHEL 7
# systemctl restart gdm.service
3. Additionally, it will be required to allow connections from remote clients’ tcp ports in the 6000 range (since the clients will be acting as an X server, using port 6000/tcp and above). As an example, one could configure a rule with iptables that matches via source ports, e.g.:
For RHEL 6
# iptables -I INPUT -p tcp --sport 6000:6010 -j ACCEPT
For RHEL 7
# firewall-cmd --permanent --zone=public --add-port=6000-6010/tcp # firewall-cmd --permanent --zone=public --add-port=177/udp # firewall-cmd --reload
4. Confirm gdm is listening on UDP port 177
# netstat -anu|grep 177 udp 0 0 0.0.0.0:177 0.0.0.0:*
Disabling XDMCP service
1. To disable XDMCP service, just edit the file /etc/gdm/custom.conf and make sure the parameters are unset.
# vi /etc/gdm/custom.conf # GDM configuration storage [daemon] [security] [xdmcp] [greeter] [chooser] [debug]
2. Save the /etc/gdm/custom.conf file and restart the GDM service.
For RHEL 6
# init 3 # init 5
For RHEL 7
# systemctl restart gdm.service
Troubleshooting
Follow the steps below in case XDMCP is not working on the server or GDM is not starting (user ‘gdm’ doesn’t exist).
1. Verify that the desktop is installed properly:
# yum groupinstall "Desktop"
2. Create the gdm user:
# useradd -u 42 -r -s /sbin/nologin -d /var/lib/gdm gdm
3. Correct permissions on /var/lib/gdm.
# chown -R gdm:gdm /var/lib/gdm
4. Restart XDMCP/GDM.
# init 3 # init 5
5. You should now be able to run GDM and use the graphical environment.