P
P
Pavel2019-11-04 10:28:44
SSH
Pavel, 2019-11-04 10:28:44

How to connect WinSCP to sftp using command line?

I'm trying to connect by example via ssh
https://winscp.net/eng/docs/scripting

"d:\temp\WinSCP\WinSCP\WinSCP.com" ^
  /log="d:\temp\WinSCP\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://логин:пароль@адрес_сервака/ -hostkey=""ssh-rsa 2048 AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UxJK"часть кода скрыта"DAV8ZUIInB3Ov+x=""" ^
    "synchronize local -criteria=time d:\temp /test1" ^
    "exit"

for some reason, when I open a bat file with this content, it instantly closes does not let me see what the problems are, pause does not help, I tried to do this with an FTP connection and everything worked, the whole snag is in the ssh key, I don’t understand exactly how to insert it so far
i'm generating it
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

an example from the Internet
fBDHPPQ.png
how to enter everything correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey c0re, 2019-11-08
@erge

the whole snag is in the ssh key, how exactly it should be inserted, I don’t understand yet

Well, what is incomprehensible? the syntax of the open command is described:
https://winscp.net/eng/docs/scriptcommand_open
sssh key is inserted via the option
-privatekey= - path to the key file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question