using scp to copy files from 1 unix server to another regularly and performing certain actions. to do this quickly I wish to use a unix script which does the scp and inputs the password required to complete the scp.
I have tried the expect command to send the password throught the unix command line however unable to achieve this so far.
sample commands
scp ./abc.txt hostname/abc.txt
expect "*password:*"
send "mypassword\r"
I get these errors:
couldn't read file "password: ": no such file or directory
myscript.sh[5]: send: not found [No such file or directory]
am I missing something?
Just pass with sshpass -p "your password"
at the beginning of your scp
command
sshpass -p "your password" scp ./abc.txt hostname/abc.txt