How to respond to password prompt when using SCP in a shell script?

后端 未结 12 1179
旧巷少年郎
旧巷少年郎 2020-12-16 19:21

First of all, I am well aware of that there are many of questions regarding this topic. I have read them, but still could figure out an appropriate answer for my situation.<

12条回答
  •  攒了一身酷
    2020-12-16 19:51

    Consider using keys, or an external library.

    I don't think it's possible otherwise (I hope I'm not wrong), as it imposes automatic brute force intrusion and sniffing of passwords.

    There are libraries that can do what you want (use the SFTP protocol, not calling scp), such as libssh.

    Again, I highly recommend keys.

提交回复
热议问题