Starting X sessions in Cygwin
Question: "I want to have my Linux desktop in my Windows machine. I have installed Cygwin. How to do this?"
Follow these steps:
A note on the "-clipboard" option above: if you don't give this option, X server doesn't share the windows clipboard with the applications running in it, hence you will not be able to copy/paste between your Windows and Linux applications.
Update on 1/28/2008: I found that giving the "-keyhook" option lets you switch between the frames inside Cygwin/X using Alt-TAB. You should give it like:
Follow these steps:
- Start your Cygwin command shell.
- Give "xinit -- -clipboard" in the command line. You will see a bare X window show with a command prompt in it. You will also see something like "Cygwin/X - 0:0" on the left-top of the window. This tells you the display in which the X server is listening for incoming connections.
- Give "xhost +" in the command prompt. This is to let the server accept all the incoming connections. Remember: if you are concerned about the security, refer to the man page of xhost on how to give a list of hosts instead of wild card "+".
- Start an ssh connection to your Linux box.
- Once logged in, set the display variable. As per this example it would be "export DISPLAY=x.x.x.x:0.0" where x.x.x.x is the IP address of your Windows box.
- Start your Gnome session by giving "gnome-session". Voila! You will see your desktop in your X window.
A note on the "-clipboard" option above: if you don't give this option, X server doesn't share the windows clipboard with the applications running in it, hence you will not be able to copy/paste between your Windows and Linux applications.
Update on 1/28/2008: I found that giving the "-keyhook" option lets you switch between the frames inside Cygwin/X using Alt-TAB. You should give it like:
xinit -- -clipboard -keyhook
Comments
for example, in cygwin terminal:
> XWin -multiwindow -clipboard &
> export DISPLAY=":0.0"
> ssh -C -X -l user -f host /usr/X/bin/xterm -title "voila@hostname"
and there you go. X apps launched in the remote xterm magically pop up on the local win/cyg box.
i'm pretty ignorant of how the X tunneling works in ssh, there might be security considerations. but it works well for me.
maybe i'm unknowingly exploiting some clever env setup on the client side, but i don't think so.