This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Howto: starting ssh-agent/keychain and launching remote apps


Hi there,

I use xterms on remote machines, and really don't want to have to start a cygwin prompt every time. With the setup shown here, you can create a windows shortcut, that will ssh to and launch an app on a remote machine without any cygwin prompt and without any annoying dos boxes hanging around in the taskbar.

If anybody has gotten this to work in a simpler way, I'd love to hear about it. But in order to source the .keychain/<mach>-sh and then run ssh I have to run bash. Running bash gives a nasty dos box, unless I use 7 lines of Visual Basic. Simpler suggestions? It has taken me a while to get it to work, and so I thought I'd post the howto here.

I'd like to write the documentation for this too (e.g. in "Displaying Remote Clients" in the UG), but would like first to hear if this is useful to anybody. If so, I'll write the docbook documentation and submit a more complete patch.

Until then, here is a patch to startxwin.bat. I want the ssh-agent (keychain) opened when the x-server is started, so I'm good to go immediately.

Also, it describes in a REAME manner how to get a desktop icon working effortlessly.

Here is the patch.

Mail breaks the lines of the patch. Here is a URL too:
http://purl.oclc.org/NET/pmorch/startxwin.bat.patch

--- startxwin.bat.orig	2004-04-16 13:43:06.129258200 +0200
+++ startxwin.bat	2004-04-16 14:20:00.064851500 +0200
@@ -145,6 +145,43 @@
 run XWin -multiwindow -clipboard


+REM
+REM Startup the keychain to hold your ssh private keys. This will allow
+REM you to ssh to remote hosts without being asked for a password.
+REM It requires that the keychain package is installed. It is found
+REM in Setup/Utils/keychain.
+REM
+REM First, set up your ssh keys so they work with ssh-agent and ssh-add.
+REM It works when you can do e.g. "ssh remotehost" and you are not
+REM asked for a password. Get this to work first in a normal cygwin prompt.
+REM
+REM Check out one of the howtos here:
+REM http://www.google.com/search?q=howto+ssh+keys
+REM Once that is working, keychain will make sure the ssh-agent is started
+REM and the keys are added.
+REM
+REM Then you can create desktop shortcuts to remote hosts like this:
+REM Right click on the windows desktop, select New/Shortcut,
+REM and then enter a line like this in the field:
+REM
+REM %windir%\System32\wscript.exe c:\data\scr\quiet.vbs C:\cygwin\bin\bash.exe --login -c "ssh -f -Y -A remotehost xterm"
+REM
+REM (Replace remotehost with the host name)
+REM
+REM quiet.vbs is written in Visual Basic, and its purpose is to avoid an
+REM annoying dos box that has no purpose. It must contain something like this:
+REM
+REM Set oShell = CreateObject ("Wscript.Shell")
+REM Set objArgs = WScript.Arguments
+REM ' Join and quote all the arguments....
+REM for each arg in objArgs
+REM cmd = cmd & """" & arg & """" & " "
+REM next
+REM oShell.Run cmd , 0, 0
+REM
+
+REM \cygwin\bin\bash -c "keychain `ls ~/.ssh/id*|grep -v '\.pub$'`"
+
REM Startup an xterm, using bash as the shell.


run xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash -l



--
Peter Valdemar Mørch
http://www.morch.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]