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)
Make the Windows folder a share and mount it on Linux?
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.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)
Use the samba client to mount the administrative share. Rather then having to share a specific folder from with in windows just mount
If you can't mount a share via CIFS for whatever reason, Core FTP has a very useful free SSH/SFTP server:
http://www.coreftp.com/
mounting a share is the best solution, don't forget something like the 'dos2unix' commad to covert newline characters.
If the Windows system has an SSH server, that'd work. If not, you could do an SMB/CIFS mount of the drive on the Windows system, then copy the file to your local Linux drive.
A few options.
You could mount a Windows share using SMB and then perform the copy/move/etc as needed. You could place the file on a web space and use
wget
to fetch it. You could install an SSH server on the Windows machine, and do ascp
. You could use NFS to access the Windows drive. You could also send Exchange logs to a syslog server (or use Splunk).You could also try using the WS-Management standard - there's a project called Openwsman for that in particular but I have no idea of it's current state or compatibility of the client tools with the Windows Vista/Server 2008 implementation. Also see winrm/winrs.