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

后端 未结 12 1145
旧巷少年郎
旧巷少年郎 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:50

    I don't think you can easily do that. What you can do is using public key authentication instead.

    Something along these lines

    ssh-keygen -t rsa
    ssh school mkdir .ssh/
    cat ~/.ssh/id_rsa.pub | ssh school "cat >>.ssh/authorized_keys"
    

    (or dsa).

    But hey, it's not serverfault, is it? ;-)

提交回复
热议问题