How would I grab a text file off of a windows machine from a linux cli?

I am writing a bash script to analyze the mail logs on our network, which is mostly postfix boxes, but would like to include MS Exchange logs in the analysis if possible.

Is there any way to copy a file off of a windows machine remotely from the command line in linux? (note: I have admin priv's on the windows box)


Solution 1:

Make the Windows folder a share and mount it on Linux?

mount.cifs //windows/share /mnt/windows -o "user=Administrator" 

Solution 2:

I use cwRsync to backup my Windows box to my Linux server. It installs as a service under Windows.

You could also use smbclient which is possibly easier to use than actually mounting the remote drive within the Linux server's filesystem.

Solution 3:

Few options:

  • Share the directory on windows and use smbmount to mount it on Linux (then you can use simple cp)

  • Install an ssh server on the windows machine (possibly using cygwin) and then you can scp the file across

  • Setup FTP server on windows machine and FTP it across (using wget/ncftpget or similar)