tag:blogger.com,1999:blog-12753102.post7864508865072206044..comments2024-03-28T15:41:37.170-04:00Comments on Ben's Journal: Tool Of The Day: WinSCPBen Simonhttp://www.blogger.com/profile/09833753747177544979noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-12753102.post-81251892987394291182007-12-18T10:42:00.001-05:002007-12-18T10:42:00.001-05:00This comment has been removed by the author.Ben Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-81210783407243968932007-12-18T10:42:00.000-05:002007-12-18T10:42:00.000-05:00I had a similar need for a windows-wide ssh sessio...I had a similar need for a windows-wide ssh session.<BR/><BR/>In my case, I wanted emacs to be able to pick up the ssh agent, so that cvs would work without prompting me for a password.<BR/><BR/>I actually found a pretty reasonable solution.<BR/><BR/>The ssh agent stuff appears to work by looking for the shell environment varaible SSH_AUTH_SOCK. It needs to be setup to point to the ssh agent directory which is found in /tmp/.<BR/><BR/>So I setup my emacs to run the following on startup:<BR/><BR/><I>ls -t /tmp/ssh*/* | grep ssh- | head -1</I><BR/><BR/>That gives me the latest ssh agent directory in /tmp/.<BR/><BR/>I then store that filename in the environment variable SSH_AUTH_SOCK and I'm good to go.<BR/><BR/>All it means is that I need to run ssh-agent / ssh-add in cygwin before I start emacs, but that's easy enough to do.<BR/><BR/>-BenBen Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-50954601674500258942007-12-18T07:08:00.000-05:002007-12-18T07:08:00.000-05:00I've been slowly (over the past 4-5 years) reducin...I've been slowly (over the past 4-5 years) reducing my dependence on 4NT, by learning how to do most of the same things in cygwin/bash. <BR/><BR/>I use cygwin's ncftp/scp commands for most of my file-transfer needs, but for my photo processing script, I ran into a snag with that. Usually, when I open a new bash shell, I run:<BR/>ssh-agent bash<BR/>ssh-add<BR/>[enter passphrase]<BR/><BR/>...and then I don't need to enter my passphrase again during that bash shell instance, when doing things like ssh/scp (especially useful for cvs-over-ssh). <BR/><BR/>But, my picture resizing script starts a new bash instance, and I didn't want to have to enter my passphrase every time I downloaded my pictures (mainly for Lacey's sake, since she downloads the pictures and runs the resizing script some of the time (but also because I'm lazy!)). <BR/><BR/>To do this, I needed to have an ssh agent that would persist through an entire windows session. I wasn't able to find a way to get a bash shell running constantly upon windows login, where I could run ssh-agent and ssh-add, enter my passphrase once, and have my batch file (any time it runs) latch onto it. It just wasn't happening. So, I ended up turning to WinSCP, because it can use <A HREF="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" REL="nofollow">pageant</A> (Putty's Agent tool) for authentication.<BR/><BR/>So, now I have pageant run in my windows startup folder (and in Lacey's as well), so when we log into windows, we just have to enter our passphrase one time in the dialog box that pageant pops up, and then we're able to use WinSCP without entering our passphrase for the rest of our windows session.spugbraphttps://www.blogger.com/profile/16847742411835463316noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-28889445344319242102007-12-18T01:34:00.000-05:002007-12-18T01:34:00.000-05:00Dave -I'd love to see that script. That's cool to ...Dave -<BR/><BR/>I'd love to see that script. That's cool to know that WinSCP is scriptable.<BR/><BR/>I've been slowly embracing this world of Windows rather than always dropping back to my Unix favorites. WinSCP seems like it belongs in my Windows toolbox.Ben Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-40322728651839006862007-12-17T07:46:00.000-05:002007-12-17T07:46:00.000-05:00It also supports some level of automation! I use i...It also supports some level of automation! I use it in the batch file that I run after downloading pictures from my camera (copies originals to another drive for backup, resizes each picture into 3 sizes, copies the resized pictures to a directory on my home web server, generates an html page and a jsp page with clickable thumbnails for each directory, and, finally, SCPs the resized pictures and html thumbnail page to another web server).<BR/><BR/>As you might imagine, this batch file isn't a just running a bunch of DOS commands. :) <BR/><BR/>First of all, it's a <A HREF="http://www.jpsoft.com/4ntdes.htm" REL="nofollow">4NT</A> batch file, which means it already has more power available to it than CMD.exe. So, there are loops, conditional execution blocks, subroutines, piping and redirection of stdout/stderr to multiple output locations, environment-variable-string-manipulation, etc. <BR/><BR/>It also runs a bash script via <A HREF="http://www.cygwin.com/" REL="nofollow">cygwin</A> to generate the thumbnail pages. <A HREF="http://www.imagemagick.org/script/index.php" REL="nofollow">ImageMagick</A> is used to resize the images, and WinSCP is used (see, this comment *IS* relevant! really!) to send the pictures/html page to the off-site web server. The WinSCP part runs a small script, which is generated for each directory, by the batch file.<BR/><BR/>I've really been meaning to post this batch file on <A HREF="http://www.spugbrap.com/blog" REL="nofollow">my blog</A>, but the code is kind of scary. :) I may do it soon, though, since I've already typed up most of the text, in this comment! So much for <A HREF="http://benjisimon.blogspot.com/2007/04/one-sentance-stories.html" REL="nofollow">brevity</A>.spugbraphttps://www.blogger.com/profile/16847742411835463316noreply@blogger.com