uploading a file through command line with SSH

Advertisement

Greg T
Guest

uploading a file through command line with SSH

Been wrestling with this all morning and hit a point where I need to raise my hand for some assistance.
Here is my line I'm running and output

winscp /command "option batch abort" "option confirm off" "open sftp://user:password@remotesite.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "put -nopreservetime tester.txt" "exit"
Searching for host...
Host does not exist
batch abort
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user@remotesite.com
Unknown command '1024'.

when I run it in these chunks it works without issue. Just combined it complains. Any thoughts?
winscp /command "option batch abort" "option confirm off"
open sftp://user:password@remotesite.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
put -nopreservetime tester.txt
exit

so I'm thinking it's syntax at this point. I just don't see it at this point. Any help?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: uploading a file through command line with SSH

You need to double the double-quotes around command arguments:
winscp /command "option batch abort" "option confirm off" "open sftp://user:password@remotesite.com -hostkey=""ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx""" "put -nopreservetime tester.txt" "exit"

See:
https://winscp.net/eng/docs/commandline#syntax
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum