1 - Create the keys as already reported in the comments. Use the commands below:
ssh-keygen
- Answer the questions, you can type for all
2- Copy key to target host
ssh-copy-id host_ou_ip_destino
If the target machine uses another user or port in SSH make the copy like this:
ssh-copy-id "[email protected] -p 2200"
Confirm the options that appear from finger-print recording.
3 - Testing authentication with keys.
ssh host_ou_ip_destino
4- To copy the directory, although sending a tar is more efficient as commented in your post by Daniel Omine, utilize:
scp -rp dir_origem [email protected]:/dir_destino
EDITING TO GENERATE LOCAL TAR
5- To generate a local tar with remote files, use:
ssh [email protected] "tar -cvzf - /dir_remoto/origem/" > local.tar
Source:
Copy directory: https://serverfault.com/a/264598/209974
Beget
and copy key:
https://darkstrikerd.wordpress.com/2010/05/14/usando-ssh-ou-scp-sem-senha/
Hi Celso, it worked the way you answered, just one more question, how to create tar straight on the other machine and pull tar instead of directory ?
– Alan PS
Thanks Celso!!!!!
– Alan PS
In the example I posted there, it is easier than with SCP, because tar is created on the direct local machine. It will not even generate a tar on the remote machine.
– Celso Marigo Jr