Copy files to another computer by ssh without password
Many times we need to perform automatic tasks and copy files between computers via ssh, the problem we always have is that when trying to connect it asks for the password of the destination computer and of course, this breaks all the automatic sequence, to perform this task should be a person entering the password every time. So we are interested in working with ssh without a password.
Until now, I had been using a sequence in which the public key and the private key were generated from the source computer, the generated key was copied to the destination computer, the key was added to a configuration file of the destination computer and thus detected the equipment as a team with a trust relationship and let us access and copy files through the ssh protocol without the need to enter a password .
Today I have another way of doing it much simpler, with the ssh-copy-id instruction.
The sequence to be made would be:
In the source computer, we generate the key rsa ssh-keygen -t rsa.
Once the password is generated (without password) with the command ssh-copy-id -i (location of the public key, usually in the .ssh / id_rsa.pub folder) target_computer_username@ip_equipment_office, with this command it will ask for the password of the destination team and copy the key in the file of trusted keys of the target computer, this way we saved a job of several instructions, I found it a pass and I avoided a lot of mess.
If we want to access the destination machine, it will be enough with ssh user_equipo_destino @ ip_equipo_destino and we will access without a password.