I will make scp be on cronjob so I would rather use to auto enter the password of the other server.
sshpass -p 'your_password' scp firstname.lastname@example.org:/usr/etc/Output/*.txt /usr/abc/
This script didn't work for me, I am using Solaris.
Please also indicate an explanation on the answers. Thank you.
#!/usr/local/bin/expect -f spawn bash -c "scp /apps/DASHBOARD/xx/xxx/xxxx/TEST1.*.txt dash@MYSERV:/apps/DASHBOARD/xx/xxx1/" expect "*Password:*" send "pass123\r" interact spawn bash -c "scp /apps/DASHBOARD/xx/xxx/xxxx/SAMP1.*.txt* dash@MYSERV:/apps/DASHBOARD/xx/samp1/" expect "*Password:*" send "pass123\r" interact
And I put this on my CRONJOB. This script works for me if I ran this manually but when I set this on my CRONJOB, it doesn't proceed on the second scp.