This bash script allows me to connect from Cygwin to my Xvnc server ("myserver.edu"), which is allowing connections only from localhost:

------------------------begin script on next line-------------------------
#!/usr/bin/bash

ssh -f -L 25901:127.0.0.1:5901 myserver.edu sleep 10
vncviewer Shared=true DisableWinKeys=true localhost:25901:1 &
------------------------end script on previous line-----------------------

The first line creates an SSH tunnel and the second line launches the VNC viewer. The VNC server is running on myserver.edu display :1, port 5901. The same or similar scheme should work on Linux and Mac.

Next I wanted to put something on a flash drive to allow myself to connect quickly from any XP machine, even without Cygwin. This was trickier. I decided to use plink...

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

...but plink doesn't have the -f option, so a batch file with these two lines never executes the second line:

plink.exe -2 -N -L 25901:127.0.0.1:5901 myserver.edu
vncviewer.exe localhost:2590:1

What I came up with next works nicely, but it seems a bit inelegant so I'm hoping one of you smart people will have an even better way. Here is my batch file:

--------------------begin batch file on next line-------------------------
start plink.exe -2 -N -L 25901:127.0.0.1:5901 myserver.edu
ping -n 10 localhost > NUL
start vncviewer.exe Shared=true DisableWinKeys=true localhost:25901:1
--------------------end batch file on previous line-----------------------

The first line causes a command window to pop up where plink prompts for username and password. The second line tells Windows to wait 10 seconds (there is no "sleep" command in Windows) while the password is entered. The last line launches vncviewer. The plink window can be minimized, but it must not be killed or the vnc connection will be killed, but after you finish with vncviewer, you can kill the plink command window.

It could be neater, but maybe the trick will be to use something other than plink. Thanks in advance for any tips.

Best,
Mike
_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to