Expecting a password in the middle of script in RHEL [closed]

I want to copy files from another server it's expecting a password to copy... Where as sshpass is working in Ubuntu, but in RHEL is there a way to pass the password in the script.


Solution 1:

sshpass is available from EPEL repository. Technically not a part of CentOS, but easy to enable if you wish.

Passwords are insecure, consider any other method of ssh auth instead. sshpass's reason for existing is a hack to get around OpenSSH intentionally making this difficult.