Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to perform an automated scp (every two hours) from a Windows 2012 server to a Linux server. I know how to do it from a Linux server to another Linux server (ssh and cron).

On Windows, what tool do I need? I know ssh is not native on Windows so I would like to use a similar tool.

share|improve this question
    
SCP? Why not the newer SFTP? – wb9688 Feb 14 at 18:36

You use WinSCP and windows scheduled tasks. WinSCP's site has a guide on scripting and automating it: http://winscp.net/eng/docs/scripting

You will also have to setup private keys so no password is required.

share|improve this answer
    
Thanks for the link, I did not know of WinSCP. Good to know it is GPL also. – Bluehorn Feb 16 at 18:02

You can use the pscp utility to handle the file transfer. Setup an authentication key to be able to login without having to enter a password.

To handle the timing create a scheduled task to execute the pscp command (or a batch file) on the desired schedule.

share|improve this answer

You can install OpenSSH on the Windows 2012 server. Here's the relevant page on the WinSCP (the SCP client for Windows) website.

Once you've done that, simply set up a cron job from the Linux destination server to fetch the files from the Windows 2012 source server. (It's easier than the other way around, especially because you said you already know how to do that.)

share|improve this answer
    
thanks, if I do the scp from the distant Linux server, why would I need winscp? Other question, is it easy to register the ssh key with OpenSSH to allow the linux server to perform the SCP without entering the password? – user1260928 Feb 14 at 14:15
    
1) You do not need WinSCP at all, only a SSH server to install on Windows. 2) It should be a trivial task, just read the docs. I don't know if ssh-copy-id works also towards a Win server. – dr01 Feb 15 at 9:18
    
the windows server is not accessible from the outside of the company, but I can access the remote linux server from the windows server. So I wont be able to perform the scp from linux. – user1260928 Feb 15 at 9:32

Grant probably has the preferred way, but if you don't want to learn WinSCP's scripting language then you can install Cygwin and run scp directly. Use Task Scheduler to launch scp. (You may have to create an intermediary .bat or .sh file to actually execute scp, depending on the arguments.) You can also set up sshd with Cygwin later if you need.

share|improve this answer
1  
Cygwin is likely overkill for such a task, unless you have need of other *nix utils. kicken's suggestion of pscp is far lighter. – Bob Feb 15 at 2:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.