8

I want to display xclock on another computer.

On my computer (111) I am able to ping the other computer (222) inside my home network:

$ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 44:55:66:77:88:99  
          inet addr:192.168.0.111  Bcast:192.168.0.255  Mask:255.255.255.0
$ ping 192.168.0.222

The router is a D-Link DIR-655 Wireless N Gigabit Router.

$ xclock -display 192.168.0.111:0

Displays the xclock on my computer (111) as expected. On the other computer (222):

$ xhost +

But then back on my computer (111) it also displays on my computer when changed to:

$ xclock -display 192.168.0.222:0

To attempt to verify the use of the -display switch:

$ xclock -display 192.168.0.111:0.1
Error: Can't open display: 192.168.0.111:0.1
$ ping 192.168.0.333
ping: unknown host 192.168.0.333
$ xclock -display 192.168.0.333:0

I would expect it to fail but it also displays on my computer (111) but with a bit of a delay. These results tells me that the display argument is getting to xclock.

$ uname -a
 Linux mycomputer 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:46:35 UTC 2012 i686 i686 i386 GNU/Linux

I am using LXDE rather than GNOME or KDE.

I am only attempting to get xclock to display and am not interested in addressing security issues in this question.

CW Holeman II
  • 3,654
  • 5
  • 31
  • 49

4 Answers4

5

Two things to check for: Port 6000 needs to be open on the 222 machine (configure or disable the firewall), and the X server itself needs to be listening on that port. This is often disabled in modern distros. Check if it's listening with

# netstat -nltp | grep 6000
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      10818/Xorg          
tcp6       0      0 :::6000                 :::*                    LISTEN      10818/Xorg          

If not, you can enable it for gdm in /etc/gdm/custom.conf

[security]
DisallowTCP=false

Logout/restart gdm on the 222 machine and log in again. You should then see Xorg listening on port 6000.

Peter
  • 51
  • 2
  • 1
    '/etc/lightdm/lightdm.conf and add xserver-allow-tcp=true ' for LXDE from http://askubuntu.com/questions/72812/how-to-disable-nolisten – CW Holeman II Aug 09 '12 at 20:53
4

On my computer (111):

ssh -X 192.168.0.222

followed simply by:

xclock

will run xclock on the other computer (222) and display on my computer (111).

Note: For this to work X11Forwarding should be enabled in /etc/ssh/sshd_config at computer (222)

Fholst
  • 153
  • 5
CW Holeman II
  • 3,654
  • 5
  • 31
  • 49
1

And you can do simplest :)

$ ssh -X 192.168.0.222 "xclock"
0

Here is the updated answer. It worked for me on fresh install of Ubuntu 18.04.02.

I installed ssh server to make the system accessible on ssh.

Nothing is blocked by default, to verify it. So nothing to do. iptables -L

I opened the file /etc/gdm/custom.conf and added

[security]
DisallowTCP=false

I uncomment the following in /etc/ssh/sshd_config

AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10

I restarted the machine and run the command xhost +

Now I went to the second computer and run the command, make sure xclock is installed and assuming that output of command echo $DISPLAY is :1

xclock -display IP_Address:1

You will see the xclock on the ubuntu computer.

netstat -antlp | grep 6001 was showing Xorg listening.

Dr. Mian
  • 177
  • 1
  • 6