Re: SFTPing a File From stdin

Unfortunately, I have no control over the server I'm connecting to.
WinSSHD is not based on cygwin so I have no unix commands at my disposal.
I was hoping there'd be some obscure option in sftp of scp that would
allow me to do this from the client. It seems like my only way out is to
write my own sftp client. This is what I get for proposing a "easy"
solution to my management. Thanks though!


On Wed, 12 Apr 2006 20:02:40 +0000, Darren Dunham wrote:

Me <Me@xxxxxxxx> wrote:
Is there a way to securely transfer a file from standard in? I know it's
possible when connecting to a UNIX server by doing this:

cat localFile | ssh user@host cat \> remoteFile

But I'm connecting to WinSSHD and there's no cat or dd command. I've tried
using the DOS "copy con:" command with no success. Anybody have any ideas?
I can't use temp files for reasons of security. Thanks!

I believe that WinSSHD is based on cygwin/OpenSSH. Presumably you could
install bash/cat/dd into the cygwin bits.

Or you could use a more complete cygwin installation and run OpenSSH
from it directly. Then you'd definitely have the file manipulation

Do you have activestate perl installed? Maybe push it into a perl

cat localFile | ssh user@host 'perl -pe "1" > newfile' or
cat localFile | ssh user@host 'perl -e "$file=qq(>newfile);open(F,$file); while(<>) {print F $_;}"'

Sorry I'm not sure of the particulars of WinSSHD and how it interacts
wit the command shell.