File Transfer from Linux to Windows

April 13, 2017 218 views
Applications Arch Linux

Hi All,

I have a couple of requirements which I need to achieve using Linux machine.

1) I need to transfer 2 files(1 XML & 1 flat file) from Linux machine to windows machine which was build in windows server 2012 r2.
And i need to use only sftp to transfer(not Samba Client).
2) Before sending the files I need to encrypt and send the files to Windows server.

can you please guide me how to design the above requirement.

thanks!

1 Answer

You could write a quick bash script using SCP/SFTP for transfers and if you are using say OpenSSL:

crypt-send.sh

#!/bin/bash
openssl des3 -salt -in file1.txt -out file1.crypt -pass pass:CHANGEME
openssl des3 -salt -in file2.txt -out file2.crypt -pass pass:CHANGEME
# This is the SCP Option
scp <file to upload> <username>@<hostname>:<destination path>
scp <file to upload> <username>@<hostname>:<destination path>
# This is the SFTP Option (Make Batch File)
sftp -b files.list username@hostname

If you want to use SFTP or SCP setup keys, but if you need to do SFTP option too use the batch option just put this into a files.list file with this script:

cd some-path/
binary
put file1.crypt
put file2.crypt
quit

See if that helps!

Have another answer? Share your knowledge.