Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to get X11 to work on my mac when connecting to a remote machine, and having lots of trouble. I have spent all day googling to no avail. Here are my main questions:

  1. What is the difference between ssh -X, ssh -Y, and when I do this which computer (local or remote) has the x server, and which has the clients?

  2. Does the startx command start the x server? So if I go to my terminal and hit startx all i've done is start the xserver?

  3. Why would I ever want to ssh into a remote computer and use startx? Would I need -X or -Y to use startx? It seems everything I've read about getting the desktop up for gnome/kde on a remote machine calls for you ro use startx. If I use startx in this scenario, who is the xserver, and who is the xclient?

  4. Will the window managers of gnome/kde from using startx on the remote machine interfere with mac's implementation of its own x11 window manager? is there anyway to fix it?

  5. How does something like VNC play into all of this? Is there a difference between a remote X session and just sshing into the remote machine and using startx?

  6. What is the correct way/command to get gnome/kde to run a GUI desktop on my remote machine of the server? (so the desktop displayed on my computer is the desktop of the server)? And by desktop, I mean I want wallpaper, folders, recycle bin, etc.

  7. If NX/VNC are the only ways to correctly have a true remote desktop in the sence of #6, why do the commands $gnome-session or $startkde bring up the desktop i want with ssh -X even though they don't work correctly?

It would be helpful if each of these were addressed individually, but if you can lead me towards some clear documentation that would be helpful too!

share|improve this question
1  
I would suggest you split this into multiple questions or make it a community wiki. The system does not allow for multiple correct answers and having each answered individual will create a problem. –  Diago Aug 20 '09 at 15:15
    
sorry, when i meant individually, i meant 1 post, but answer it like 1. blah, 2. blah, 3. blah so that each of my questions gets answered in the same post. i DIDN'T intend that each question # get a separate answer. –  hatorade Aug 20 '09 at 15:17
    
Fair enough, however it is accepted practice to keep to one question at a time, rather then multiples. I highly doubt you will find just one correct answer to your question. –  Diago Aug 20 '09 at 15:25
    
i made it a wiki :) –  hatorade Aug 20 '09 at 15:25
    
@Diago, why adding osx tag for this question ? Not Linux, rather ? –  Gnoupi Aug 20 '09 at 16:02
show 2 more comments

3 Answers 3

up vote 2 down vote accepted
  1. If I recall correctly ssh -X maps the X server to the target machine and then routes connections through the channel created by SSH to the terminal (i.e. your machine). The "X server" is the software that draws the window for the "X clients" which are the programs that use those windows.

  2. Yes, startx starts the X server. But on Mac OS X you start the X server by starting X11.app in Utilities.

  3. You wouldn't really want that unless you are trying to restart the X server on the computer you SSH into. But that wouldn't have anything to do with your connection to that computer or the programs you want to run via that connection.

  4. Not sure I understand the question. What window manager the remote server runs is inconsequential for your connection. Window managers run on X servers (they are special X clients) and the X server on your Mac and the X server on the remote machine are two separate beasts.

  5. VNC is a different solution for the problem of displaying GUI apps remotely. You can combine the two but I recommend you try to understand them separately.

  6. Let Paul be your Mac and Peter be the (Linux) machine you connect to:

Paul: startx (or rather, start X11.app and use the terminal window it creates for the following)

Paul: xhost +Peter

Paul: ssh -X Peter

Peter: xlogo& (this should now display on Paul's screen, if not, continue)

Peter: export DISPLAY=Paul:0

Peter: xlogo& (this should now display on Paul's screen)

share|improve this answer
    
thank you, very helpful. now, in response to your answers: 1. what does -Y do? just make it so you say you trust the remote computer and let it do whatever as i have read? 2. writing startx in terminal is equivalent to hitting x11 in apps for mac, correct? 4. so far, when i ssh into a remote comp with x11 server on mine, when i type $startkde or $gnome-session the respective desktops show, but the windows are screwed up because if i open a folder, it opens in the background on my macs x11 and is therefore hidden behind the desktop so i can't get to it. i heard it was a conflict of window mngrs –  hatorade Aug 20 '09 at 15:37
    
1. Don't know what -y does. 2. Yes. They are the same. 4. Don't start KDE or Gnome when you connect from the Mac. Gnome and KDE programs don't need the entire desktop to be running. –  Andrew J. Brehm Aug 25 '09 at 14:25
add comment

Why would I ever want to ssh into a remote computer and use startx? Would I need -X or -Y to use startx? It seems everything I've read about getting the desktop up for gnome/kde on a remote machine calls for you ro use startx. If I use startx in this scenario, who is the xserver, and who is the xclient?

X has a slightly 'unusual' definition of client/server.
The machine with the graphics screen is the server, the applications are the clients. So you start the XServer locally (with startx) and run clients (the application) possibly remotely.

If you are only running local applications none of this really matters. In the old days when your application needed the number crunching power of a 'server' (ie BIG machine in basement) you could run the job on a machine with no display and have it appear on the terminal in your office.

The window manager is an interesting case. It is just an X application like anything else. It's perfectly possible to start an Xserver locally on a Mac, then have a a Motif window manager running on a Sun managing your local windows while working in an X app that is running on a Linux machine somewhere else.

ps. will answer in sep responses so people can comment/edit them.

share|improve this answer
    
@mgb: oops, let me clarify (assuming this is your answer to question 3). it makes complete sense to me to use startx on MY local machine. but when i was reading about how to enable a gnome/kde desktop on a remote server, the command to use is startx. that makes no sense. why would i want the xserver to be on the remote server? is that what it's doing? –  hatorade Aug 20 '09 at 15:10
add comment

How does something like VNC play into all of this? Is there a difference between a remote X session and just sshing into the remote machine and using startx?

VNC does a similar job in a slightly different way. VNC simply takes an entire screen or a single window and sends the video over the net to a VNC app your local machine. X runs an application on the remote machine but sends all the display commands over the net to your local X display. X actually does this even when running locally but a network call to the same machine can be shortcutted and is very quick.

ps. You don't ssh into a remote machine and startx - you start the X server locally then ssh into a remote machine and start an X application (office/gimp/xeyes/etc) and X handles it appearing locally.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.