-5

I have a ftp server on my Windows server and a Linux VM running on hyper-v, as a part of automation I need to copy a file from Linux to Windows and do some other task using the information from the Linux VM.

Either I have to create a file directly on the ftp server running on Windows or copy that file from the VM using the Linux commands. I tried to copy the file using SSH, but how do I supply password?

echo 'Some Text' | ssh user@remotehost "cat > /remotefile.txt"
  • 3
    "how do i supply password?" you can use public key authentication – ALex_hha Apr 19 '16 at 7:43
2

You can try with sshpass:

sshpass -p 'you_pass' scp your_file user@remotehost:/path/to/dest
| improve this answer | |
0

You could use expect to pass the password.

A very good example can be found at https://bash.cyberciti.biz/security/expect-ssh-login-script/

More information regarding the expect command can be found at http://linux.die.net/man/1/expect

| improve this answer | |
-4

Thanks for the reply. I got my answer using the curl command

curl -T /home/vyatta/suresh/suresh.test ftp://192.168.1.*/

this worked for me

| improve this answer | |
  • 3
    What has that to do with the question as asked? If you wanted to know how to automate moving a file from a Linux to a Windows box, you should have asked that question instead. – MadHatter Apr 19 '16 at 10:32

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