When you use Scp/ssh/rsync to transfer files, you will need to enter a password. The following is a method for password-free transfer of files.
Suppose you want to transfer files between two hosts, Host_src & Host_dst. HOST_SRC is the machine where the file source address resides, and HOST_DST is the machine where the destination address resides.
1. On the HOST_SRC machine, log in with the user executing the Scp/ssh/rsync command and execute the following command:
$ ssh-keygen-t RSA
Press ENTER to continue, the default public key will be stored in the
~/.ssh/id_rsa.pub:
Your public key have been saved in <your_home_dir>/.ssh/id_rsa.pub
2. Transfer the id_rsa.pub file to the Host_dest machine via FTP, SCP, rsync, etc.
3. Log in host_dst with the appropriate account
4. Append the contents of the id_rsa.pub to the ~/.ssh/authorized_keys
$ cat Id_rsa.pub >>~/.ssh/authorized_keys
$ chmod ~/.ssh/authorized_keys
5. Note that SSH does not allow root login by default, you need to modify the Permitrootlogin option of the/etc/ssh/sshd_config file and change no to Yes.
Reference: Https://blogs.oracle.com/jkini/entry/how_to_scp_scp_and
Scp/ssh/rsync operation method without entering the password