Areebah
Areebah

Reputation: 43

Enter Password through bourne shell script when asked by the command without expect

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 [email protected]:/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?

Upvotes: 0

Views: 822

Answers (1)

Max
Max

Reputation: 1390

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 [email protected]:/home/shah/

Upvotes: 1

Related Questions