OpenSSH 8.0 released
OpenSSH 8.0 released
Posted Apr 30, 2019 12:45 UTC (Tue) by ScottMinster (subscriber, #67541)In reply to: OpenSSH 8.0 released by mbunkus
Parent article: OpenSSH 8.0 released
But is there a better way to solve the original problem? If you have a directory tree with files with varying user and group IDs that you want to sync to a remote server, what is the best way to do it?
Using tar (something like "tar -c . | ssh server2 sudo tar -C /path/to/dest -x") would work if you didn't care about transferring all the data. If the destination is empty, you'd have to do that anyway. But suppose you just needed to update the copy?
I would expect that running 'rsync' as root on the destination machine would work, as in "rsync -a server1:/path/to/source /path/to/dest". But that assume that you can ssh from server2 to server1, which isn't always the case.
Is there some more obvious method I'm missing?
Posted Apr 30, 2019 14:46 UTC (Tue)
by excors (subscriber, #95769)
[Link]
rsync -e 'ssh -X' --rsync-path='SUDO_ASKPASS=/usr/bin/ssh-askpass /usr/bin/sudo -A /usr/bin/rsync' -a server1:/path server2:/path
Posted Apr 30, 2019 14:59 UTC (Tue)
by mbunkus (subscriber, #87248)
[Link]
Another thing you can try if your source machine allows root-login-via-ssh is reversing the direction of the transfer: instead of running rsync on "source" ssh'ing to "destination", ssh from "source" to "destination" with a reverse port forwarding to "source:22" and run rsync on "destination" with "localhost:<forwardedPort>" as the source address.
OpenSSH 8.0 released
OpenSSH 8.0 released