Using a variable's value as password for scp, ssh etc. instead of prompting for user input every time

前端 未结 10 1563
独厮守ぢ
独厮守ぢ 2020-12-03 03:38

AFAIK, the commands ssh or scp do not have/take a password parameter. Otherwise I could keep the password in a shell variable and probably get rid

10条回答
  •  遥遥无期
    2020-12-03 04:31

    Today, the only way I was able to do this in a bash script via crontab was like that:

    eval $(keychain --eval --agents ssh id_rsa id_dsa id_ed25519)
    source $HOME/.keychain/$HOSTNAME-sh
    

    This is with the ssh agent already running and to achieve that it was needed the passphrase.

提交回复
热议问题