ssh copy code example

Example 1: copy ssh key to remote server

ssh-copy-id -i ~/.ssh/mykey.pub user@host

Example 2: copy ssh keys

pbcopy < ~/.ssh/id_rsa.pub

Example 3: how to copy ssh key

ssh-copy-id -i ~/.ssh/mykey user@host

Example 4: centos copy files ssh

scp <source> <destination>

#To copy a file from B to A while logged into B:
scp /path/to/file username@a:/path/to/destination

#To copy a file from B to A while logged into A:
scp username@b:/path/to/file /path/to/destination

Example 5: copie fichier de server vers linux

scp -r -p chemin/vers/dossier/source user@serveur2:chemin/vers/dossier/destination

Example 6: ssh copy past

scp [email protected]:/share/music/filename1.mp3 /var/tmp
mp3 to /var/tmp

scp -r [email protected]:/share/music/album1 /var/tmp/
So now all the folder with mp3's /share/music/album1 will save to /var/tmp/