It is often the case that you need to automate a copy of a file to another server with scp, such as making a backup on one server and send it to another server that uses it as a file server, as a problem that when invoking the server scp command, this one, ask for password or password.
This we can avoid
On the source computer we launch:
ssh-keygen -t rsa
This command generates two files, id_rsa.pub and id_rsd. We need to copy the contents of the first to the other computer and add it to the authorized_keys file inside ~ / .ssh /
By scp we send this file id_rsa.pub to the destination server
On the destination server we add the file to authorized_keys
cat id_rsa.pub >> .ssh / authorized_keys
And we can make a scp without a password