Interact with sftp (cygwin) from application on Windows?

Cygwin has packages for tons of common UNIX utilities including expect and (probably) empty. In theory you could still use those... (not that this would be the most secure, compact, or ideal option... but it's an option! ).

Up vote 1 down vote favorite share g+ share fb share tw.

On Unix you have tools like Expect and Empty for interacting with terminal applications like sftp, using pseudo terminals. I have a Windows machine with cygwin installed on it and my C# app needs to start an sftp session to transfer some files to a remote machine. I started with some code like this var p = new Process(); p.

StartInfo = new ProcessStartInfo { FileName = "sftp", UseShellExecute = false, CreateNoWindow = false, RedirectStandardInput = true, Arguments = username + "@" + server }; p.Start(); p.StandardInput. WriteLine(password); The problem is that sftp will not read a password from stdin, only from the terminal. That's where Expect comes in.

Outside of installing Expect in cygwin is there any way to interactively send a password to sftp from a C# program? C# ssh cygwin sftp expect link|improve this question edited Aug 19 '11 at 15:05 asked Aug 19 '11 at 14:47Peter Kelly2,936817 96% accept rate.

Using public-key authentication might be less problematic – hircus Aug 19 '11 at 15:01 I agree it would be less problematic and we could set up password-less sessions but this is the way it is - have to support usrname/pwd interaction through code. – Peter Kelly Aug 19 '11 at 15:04 1 any reason you are not using a pure . NET sftp client (with all the options for authentication etc.)?

– Yahia Aug 19 '11 at 15:07 @Yahia Is there a stable, production-quality free . NET SSH library that is OpenSSH compliant? – Peter Kelly Aug 19 '11 at 15:18 production-quality/compatible/stable are several, although the ones I worked with are commercial... free are for example sshnet.codeplex.com and routrek.co.

Jp/library/support/download/varaterm/… though I never used that so can't say anything regarding production-quality – Yahia Aug 19 '11 at 15:22.

Cygwin has packages for tons of common UNIX utilities, including expect and (probably) empty. In theory you could still use those... (not that this would be the most secure, compact, or ideal option... but it's an option! ).

Cheers, I did say "outside of installing Expect in cygwin" but this might be the way we end up going if there is no alternative. – Peter Kelly Aug 19 '11 at 15:32 Right... I need to read more carefully! :D – ewall Aug 19 '11 at 15:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions