2

A client wants us to push data files to them on a daily basis using SFTP (FTP over SSH). We are a 100% Microsoft shop with no Linux admins on staff. I am looking for recommendations on how to do achieve this. I have seen different applications for automating the sending of files via SFTP, but I don't know if they are a good approach or not.

What have you found to be the easiest way to deal with this in a Microsoft Environment?

Brettski
  • 942
  • 3
  • 20
  • 30

4 Answers4

6

I recommend PSFTP as the client of choice for transfering this data to the remote destination. http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Their products are rock solid and have become quite popular from the success of PUTTY their SSH client.

Nick O'Neil
  • 1,769
  • 11
  • 10
  • PSFTP is a good utility- but to script it, you have to use something like Expect or similar that can interact with a terminal application, right? – mfinni Jan 20 '11 at 21:11
  • 1
    Aha - "-b: specify a file containing batch commands" – mfinni Jan 20 '11 at 21:15
2

You just need an SFTP client and a way to script and schedule it.

  1. WinSCP is very common for the client software. It is scriptable thus...
  2. you'll want to use whatever you're comfortable with and preferably already using - batch, powershell, VBScript, KiXtart, whatever.
  3. You can schedule it with the build in Scheduled Tasks.

That's the simple way, using all native tools, and only one third-party component. The tricky bits will be :

  1. the logic of your script. How will you handle errors? All kinds of errors - you lost the internet so their side went down. The fileserver you pull from got misconfigured and you couldn't delete the file after it was sent. Actually, that's another question - are you deleting them after they are sent? Are you feeding a pipeline, or an archive copy?
  2. How will you handle the possibility of multiple jobs running - the 1 AM job takes too long, so it's still running when 2 AM starts, for example. You can work on some of that with the built-in capabilities of the scheduler, like killing tasks that take too long.
  3. Does this need to be HA? If your server fails, do you need another to pick up where it left off?

You could conceivably get your script running a loop and install it as a service, so you don't have to worry about multiple jobs trying to grab the same files.

mfinni
  • 35,711
  • 3
  • 50
  • 86
1

I have been using this Open Source/ free .Net component to deliver files to SFTP without any issues for the last 2 years.

If you reference the assembly files (Tamir.SharpSSH.dll + 2), in few lines of code you can do SFTP..

            Sftp sftpClient = new Sftp(host, userName, password);
            sftpClient.Connect();

            sftpClient.Put(filePath, @"filename.txt");
            sftpClient.Close();

You can develop a windows application or a windows service to deliver fules

Download Assembly Here:

http://www.tamirgal.com/blog/page/SharpSSH.aspx

Description: SharpSSH is a pure .NET implementation of the SSH2 client protocol suite. It provides an API for communication with SSH servers and can be integrated into any .NET application. The library is a C# port of the JSch project from JCraft Inc. and is released under BSD style license.

SharpSSH allows you to read/write data and transfer files over SSH channels using an API similar to JSch's API. In addition, it provides some additional wrapper classes which offer even simpler abstraction for SSH communication.

Jeganinfo
  • 111
  • 2
-1

If you are looking for a scriptable and automatable SFTP client that not only runs on Windows, but it is designed with Windows in mind (it does not mimic Linux-style shell-like scripts, but it uses high level object-oriented languages like JavaScript) you may want to take a look at Syncplify.me FTP Script.

FjodrSo
  • 294
  • 1
  • 6