The solution is derived from this link.
Edit the file /etc/lightgdm/lightgdm.conf and add the following line towards the end of file:
xserver-allow-tcp=true
and restart your system.
Open a terminal and run the following commands:
$ xhost +
allow any user to connect to the xserver
$ telnet
Once you login, type in the following commands:
$ export DISPLAY=
$ xterm &
You should be able to see the terminal.
On your own computer (not the remote server), you can run the following command to verify if there is any "-nolisten" variable with tcp.
$ ps -ef | grep listen
nobody 1182 839 0 19:33 ? 00:00:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
mayank 5323 5064 0 20:17 pts/0 00:00:00 grep --color=auto listen
As you can see, it is not there and hence things should work properly now.