-3

I was wondering if its possible to copy files from my Linux server onto my Windows server. I have seen other methods such as pscp and winscp but they involve the commands being ran on the Windows machine. What I am trying to do is somehow do the copying while I am on the linux machine.

auahmed
  • 153
  • 1
  • 3
  • 14
  • 2
    Probably doesn't belong on SO. You could enable file sharing on the windows Side, and then use `smbclient` from samba on the linux side. or install an FTP server on the windows side. etc.. There are lots of options. – Doon Dec 19 '14 at 19:05
  • @Doon im sorry i should have cleared something up. I want to create a script which will allow this. I already have a script for linux to linux by using SCP but now i am stuck on how to do it with linux to windows. and how would this question not belong here? just so next time if i need help on a similar related question ill go somewhere else – auahmed Dec 19 '14 at 19:59
  • well you question doesn't mention a script. or do it via code. Still might be better asked at server fault maybe superuser. but you can script smbclient. i'll post an answer which might help – Doon Dec 19 '14 at 20:05

2 Answers2

1

you should be able to script smbclient as part of a script

 smbclient -A authfile //windows_machine/D$ -c 'cd \\PATH\TO\Directory; get "Filename.txt" myfile.txt'

where authfile would be

username = <myusername>
password = <mypassword>

This would assume File Sharing enabled on the Windows Machine, and samba installed on the linux side. //windows_machine/D$ is the D Share. but you could replace it with whatever share you create.

or you could install an FTP server on your windows machine and can either script an FTP client or use something like curl || wget

Doon
  • 18,294
  • 3
  • 35
  • 42
1

Install cygwin on your windows server and set it up to run sshd:

https://cygwin.com/

John Rigler
  • 143
  • 1
  • 6
  • Can you please explain why this would help? – John Odom May 05 '15 at 18:19
  • You either need to make the Linux/Unix server speak "Windows" or make the Windows server speak "Linux/Unix". You could load Samba onto the Linux server and access SMB as the other poster noted. If you have control over the Windows server and want to learn more Linux, then you can install the cygwin subsystem. You could then configure a very secure "unixy" connection using SSL encrypted port 22. – John Rigler May 05 '15 at 19:05