PDA

View Full Version : xhost question



nitao
19th May 2006, 10:54 PM
Hi~

I am currently have four monitors driven by two machines (so dual head connection). One machine acts as master and the other as slave. They are correctly connected (I can ssh from one to the other).

I am trying to use x2x so that I can log in the slave from the keyboard and mouse connected to the master.

I first ran "xhost master.host.name:0.0 on the slave, and I also ran xhost slave.host.name:0.0 on the master. But x2x does not work (saying cannot open display slave.host.name:0.0. I thought it's probably because I did not set up DISPLAY env variable. So on the master, I set DISPLAY as master.host.name:0.0, and on the slave, I set DISPLAY as slave.host.name:0.0. Now, however, I cannot even run "xhost slave.host.name", since it says "xhost: unable to open display "master.host.name:0.0". It's pretty weird. Does anybody have an idea what happened here?

Thanks.

jcliburn
19th May 2006, 11:51 PM
Make sure port 6000 is unblocked on both systems.

nitao
20th May 2006, 12:39 AM
How to enable large range of port (e.g. 6000)? Thansk a lot!

jcliburn
20th May 2006, 01:00 AM
You need to unblock only those ports that correspond to display numbers. So if you're going to send a window to display 0, unblock port 6000. If you're going to send a window to display 1, unblock port 6001. And so on...

To unblock port 6000 edit /etc/sysconfig/iptables and add this line just before the line that contains "reject-with icmp-host-prohibited"

-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 6000 -j ACCEPT

You may omit the -s if you want to open the port to the world. Change 192.168.1.0/24 to whatever network you want to allow to connect.

Then restart iptables with the command "service iptables restart".

nitao
20th May 2006, 01:13 AM
Thanks for your information! I'll follow the steps and try. So I guess I only need to do this on my master machine, since on slave I've already turned off the firewall service. There won't be any problem, right? I am using 192.168.20.1 for master and 192.168.20.2 for slave. So is it safe to simply change 192.168.1.0/24 to 192.168.20.0/24? Also, in my first post, is there anything wrong with DISPLAY setup for running x2x?

jcliburn
20th May 2006, 01:26 AM
Yes, it's safe to simply change 192.168.1.0/24 to 192.168.20.0/24 in the iptable rule.

You should turn the slave's firewall back on and modify it to work with your configuration.

I'm not familiar with x2x, so I can't say one way or the other whether you're set up correctly for it. What I do know is when one X server needs to send a window to another X server on a remote host, and you're not using ssh for X forwarding, the remote host must have port 6000 (or higher, if you're using higher display numbers) unblocked. You *may* also need to enable TCP connections on the remote X server. This is most easily accomplished by using /usr/sbin/gdmsetup. On the "Security" tab, uncheck "Deny TCP connections to Xserver".