Timeline for How to rsync files between two remotes?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 29, 2023 at 22:18 | comment | added | Eric Hansen | What can I do if I need sudo permissions on host 1 (ex. files from host 2 have to be written to root directories on host 1)? This answer works great if sudo isn't required. However, host 1 can't seem to use my forwarded SSH key with sudo. For example, ssh -A host1 sudo rsync -vuar /var/www host2:/var/www doesn't work. | |
| Apr 15, 2022 at 9:12 | comment | added | Tms91 | @Kevin Cox >"why you didn't want to log into one host and then copy to the other" . This did the trick for me, thanks a lot! :) | |
| Aug 26, 2021 at 16:20 | comment | added | Matthias | This worked best for me. I did need to add my ssh key to the SSH Agent with ssh-add first. | |
| Aug 19, 2021 at 1:52 | comment | added | logicor | You forgot to mention that this solution require host1 to have direct network access to host2, which a lot of the times is not the case. | |
| Mar 7, 2018 at 13:40 | history | edited | Kevin Cox | CC BY-SA 3.0 | deleted 1 character in body |
| Mar 7, 2018 at 10:15 | comment | added | John Zwinck | Phenomenal answer, this helped me orchestrate some things in TeamCity that I wasn't able to do before (n.b. for other TeamCity users, you must add the "Build Feature" called "SSH agent" to your build config before using ssh -A, see confluence.jetbrains.com/display/TCD10/SSH+Agent). | |
| Aug 21, 2017 at 8:21 | comment | added | Cedric Knight | +1 for explaining a valid use case (where the remote user on host1 has no permissions on the destination server); for the important security caveat (use port forwarding -D rather than -A to get around network rather than key restrictions); for explaining the advantage; for the command being short; and it actually working. Note that you may need to specify username@host1 if it's different from local username. Also that rsync performs host key verification when connecting to host2, so host1's key should already be in ~/.ssh/known_hosts on host2 or the command will fail. | |
| Dec 3, 2015 at 14:25 | history | answered | Kevin Cox | CC BY-SA 3.0 |