You can try to use sshpass
tool but you will need to provide a password in clear text in your script. If that is not a problem you should use it.
sshpass -p 'password' scp /etc/clients.txt shah@192.168.1.2:/home/shah/
Вопрос
I am writing a bourne shell script for the openwrt firware where I want to copy my files from router to linux machine. when i do
scp /etc/clients.txt shah@192.168.1.2:/home/shah/
from inside the router's openwrt firmware, it asks me to give the password. I want to give this password from within the script because this file needs to be copied after every 2 seconds. How can I do this without using expect?
Решение
You can try to use sshpass
tool but you will need to provide a password in clear text in your script. If that is not a problem you should use it.
sshpass -p 'password' scp /etc/clients.txt shah@192.168.1.2:/home/shah/