-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"
1
  • 3
    "how do i supply password?" you can use public key authentication
    – ALex_hha
    Apr 19, 2016 at 7:43

3 Answers 3

2

You can try with sshpass:

sshpass -p 'you_pass' scp your_file user@remotehost:/path/to/dest
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

-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

1
  • 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, 2016 at 10:32

Not the answer you're looking for? Browse other questions tagged .