![]() |
X Windows - running apps from another Mac
I've got XFree86 4.2 installed on both our Macs - I did it via Fink, and everything appears to run correctly on both machines. The Cube has quite a few X Windows apps installed, but the poor old original iBook is short of disk space, so I've only got one X Windows app on it. I know I should be able to log into the Cube via Airport, and run its X Windows apps on the iBook.
Well, I've pored over the man pages, surfed the web for hours looking for how-to info, but I can't get it working. I've tried starting an XTerm on the iBook, then doing ssh -X <IP address of the Cube>. After logging in, I type the name of an X Window app, but I get: Error: Can't open display: I've tried this with X Windows on the Cube running and not running - no difference. I've tried setting the Display variable, but I'm not sure I know what I'm doing here. I would be very grateful if someone who has actually done this could give me some hints. Specifically, do I need to make any adjustments to any of the various config files on either machine? (.cshrc, .xinitrc, etc). If X Windows isn't running on the Cube or the iBook, and I ssh in from the iBook, what commands do I need to run on each machine to get this working? Note: at the moment, the Cube has both OroborOSX and WindowMaker installed as window managers. I've only got OroborOSX on the iBook. I could install a more "conventional" window manager on the iBook if required. Thanks, Kevin |
Check out this thread, make sure you say xhost + ipaddy of the other comp, this is what was messing me up.
|
Not there yet...
Greg,
Thanks for trying, but we're not there yet. I walked into the office and started X Windows on the Cube. I started X Windows on the iBook, then did the following in an XTerm: [localhost:~] kwh% xhost 192.168.123.120 192.168.123.120 being added to access control list [localhost:~] kwh% ssh -X 192.168.123.120 kwh@192.168.123.120's password: Welcome to Darwin! [localhost:~] kwh% xephem Error: Can't open display: Notes: 192.168.123.120 is the IP address of the Cube. I checked the Brickhouse logs on both machines to make sure the firewall wasn't playing with me, but there are no logged entries. The console and system logs on both machines don't appear to have any useful entries. Any other ideas? Thanks, |
Have you got port 6000 opened on both machines?
Also, you still have to do setenv DISPLAY ibookip:0.0 |
Got it!!
OK. I finally cracked the code. I had an XTerm running on the Cube. I exited from it, and now everything works. Could that XTerm have been using the same display number I was trying to access from the iBook? Is there a way to deconflict the display numbers? I thought the -X option of ssh was supposed to sort all that out.
Thanks for the help Greg, Kevin |
For the Record...
For the record, here is what seems to work for me:
On the remote machine, start X Windows, but close any applications, including XTerms. On the local machine, start X Windows. In XTerm on the local machine, do the following commands: xhost +ip address of remote machine ssh -X ip address of remote machine setenv DISPLAY ip address of local machine:0.0 Then, you should be able simply start any programs you want to run via the command line. My remote machine is only about 50 feet from where the local machine normally lives, so it is not a big deal to walk into the office to start X Windows. But, I'm sure there must be a way to do this whole shebang without moving from the local machine. |
Hi,
Here's the steps you need to get an X app to display remotely: 1. Start the XServer on the client that will display the applications. 2. Run "xhost +" or "xhost +<ip of remote machine>" 3. Telnet (or otherwise login) to the remote machine. 4. Set the DISPLAY environment variable within the login session to the remote machine to "<client ip or hostname>:0.0" 5. Start an X application via the login session to the remote machine. Things to note: You do not need an X Server active on the remote machine. If you have the DISPLAY variable set for your default shell on the client, it will propogate through the login to the remote machine, and you will not have to set it each time you login. The -X option to ssh is only required if the ssh session is your only way to route X11 traffic to the client, or if you require an encrypted session. You can use rsh or ssh to remotely execute the command without performing a complete login to the remote machine. This trick works well with aliases to make starting a remote app a simple one word command. - Avi |
Doesn't work...
Avi,
Thanks for the info, but something is wrong when I try to follow your recipe on my Macs. After following the steps you outlined, and trying to open an X application, I get: Can't open display: 192.168.123.162:0.0 Note - this is the ip address for the local machine. Is there a missing step in your recipe, or maybe something that you've done to your setup that might not be present on my machine? Thanks, Kevin |
Hi,
Those are the steps I use between any 2 machines that I want to use in that manner. Normally, I am going between SGI, Sun and HP hardware, and it works the same way everytime. I've also thrown linux and VMS into the mix, and other than the commands to issue (on VMS), it worked everytime. You might try setting DISPLAY to <client ip>:0 (leaving off the ".0"). I've seen that work when 0.0 would fail. Also, if you were using ssh -X before, but didn't with my steps, you might want to try that again. If there is something specific to XDarwin, I don't know it, but I can check when I get home. - Avi |
Nope..
Avi,
I think the problem is with your assertion that you don't need an X server acitve on the remote machine (or possibly my misunderstanding of that statement - I'm pretty new at this unix stuff). If you are connecting to SGI, Sun, Hp, Linux, etc, odds are that X Windows is already running on the remote box, so you don't need to do anything extra to start it. But if I am connecting to my Cube, odds are that X Windows is not running there. Certainly I can only get things to work if I manually start X Windows on the remote machine first. Thanks, Kevin |
rv8,
Check out this hint on the main site for an applescript that launches XWindows, it seems like you could easily modify that to use over ssh - you could also try saying open -a XDarwin.app in the terminal (once sshed in), make sure you don't have the program waiting for a response (like you choosing between rootless and full screen mode. |
Greg,
Thanks for the info on open -a XDarwin.app. That works great to get X started on the remote machine. Something else has gone awry though - last night and first thing this morning I had things working well. But now I keep getting Can't open display: 192.168.123.162:0.0 messages, even though I'm doing exactly what worked before. Baffled. The only thing I changed in the interim is I went into /etc/hostconfig to edit the host name on both machines, to make it obvious which machine I was working with at the command line prompt. Having both of them say localhost was getting old quickly. I don't see how that messed things here though. I'll attack this again late this evening, and tomorrow morning. Thanks, |
rv8,
I know for a fact that an XServer is not required on the remote machine. I have run X applications remotely from machines that did not even have an X Server installed. My linux firewall/server at home is like this, as is a VAX cluster that I've used in the past. I will investigate when I get home, but I'm sure it's a simple misconfiguration. - Avi |
Ok, I've had a chance to try it at home, and it worked just as I said it should. I have a linux machine with xterm installed, and a Mac laptop with XDarwin.
I started a Terminal session and ssh'd into my linux box. I set the DISPLAY variable to laptop:0.0 I started XDarwin and brought up an xterm In that xterm, I ran xhost + From the Terminal session, I ran xterm Came up within the X session without a problem (I don't run rootless). I can't imagine why it doesn't work for you. You might want to ping whatever host identifier you're using in the DISPLAY variable from the cube to make sure it can be reached that way. - Avi |
I don't suppose it is of much importance that under XDarwin's preferences you set the X11 Display number (under 'Start Up').
I also know there is a line to an SSH config file (I think it's /etc/ssh_config) that will let you forward X11 through the ssh connection. Once that is done, I think the -X will work??? rv8, can you run remote X11 programs off of other remote machines? |
Avi - I would be interested to know what you need to do to sit at the Linux box, ssh into your Mac, and display one of its X applications on the Linux box.
Arakageeta - I dug through the ssh man pages, and as near as I can tell the X forwarding option in the etc/ssh_config file is an alternative to the ssh -X option. But those man pages are pretty heavy sledding, so I could have it all wrong. In any case, I tried setting the X forwarding option in the ssh_config file, but it didn't change the result I get. Thanks for all the assistance guys, but there is still some strangeness somewhere. |
Hi,
I couldn't run an X Server on the linux box if I wanted to. It doesn't have a monitor worthy of the name, and it has no mouse. It is a server, and I do everything remotely, as much as possible. This means that I sometimes have to run X applications and display them on my other machines. That said, I fired up my win2k machine and started an X Server there. Logged into my linux box and from there ssh'd to my laptop (PB) and set the display back to my w2k box. Started an xterm, and it appeared on my w2k desktop just as it should. Nothing special done on the Mac. Only Apps running are Finder and Internet Explorer. (The roundabout login to my laptop is because there's no telnet daemon running on OS X, and the w2k machine doesn't have ssh.) I know it may not seem like it, but there's a simple misconfiguration with your machines. I do 3rd level Unix support for a living, so I kinda know what I'm talking about :D Post the hostnames and IPs for both machines, and describe the network topology. If you'd like, we can take this to Private Messages and just post the results once we've figured it out. If you use AIM, that would be even better, and we could debug this live. - Avi |
Success!
Avi,
Thanks for the info, and the very kind offer of more direct assistance. But, it seems like I have it working. Looks like I had some interference from my firewall, even though I thought I had ruled it out as an issue. Sorry about all the confusion. Any way, it works fine now. And, as you said, I don't need to start up X Windows on the remote machine first. Still, there seem to be a few more steps than I think should be required. Presumably I could sort some of this out by messing with some config files, or failing that, I'll make an alias or shell script to handle it. Specifically, I hope to avoid doing the "xhost remote_ip_address", and the "setenv DISPLAY local_ip_address". Thanks, |
Glad you got it working.
For the DISPLAY variable... since you always have the same client, with, presumably, the same IP address, you can just set it in the startup script (.profile or .cshrc) for whichever shell you use on the server. That way it's done as soon as you log in. For the xhost, you can add a line to xinitrc or .xinitrc (see the docs for XDarwin, it's the same file that should be starting your window manager) to do that for you. - Avi |
Avi,
Thanks for the additional info. xhost - I'm using OsoborOSX as my window manager, and it uses some non-standard config files. It uses its own config file rather than .xinitrc. I've tried editing its config file, but it keeps getting changed back to the default. Very strange. But, the author of OroborOSX frequents the forums at http://sourceforge.net/forum/forum.php?forum_id=142721, so I'll take this issue over there. setenv DISPLAY - I'll mess around with this and come back if I don't get it sorted. For info on OroborOSX, see: http://wrench.et.ic.ac.uk/adrian/software/oroborosx/ Edit - moved the comma outside the URL code. Thanks, |
| All times are GMT -5. The time now is 10:12 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.