5 ms·
I prefer to use rsync over SSH as a replacement for scp: alias scp='/usr/bin/rsync --archive --xattrs --acls --progress --rsh="ssh"' I have completely depreca
by adrian_b 6y ago
I prefer to use rsync over SSH as a replacement for scp:
alias scp='/usr/bin/rsync --archive --xattrs --acls --progress --rsh="ssh"'
I have completely deprecated for myself the use of both scp and sftp many years ago and I disable the sftp server (in sshd.conf) on all my servers.
While scp and sftp are also slower, usually being unable to reach link speed on fast links, the main reason is that I have discovered that when copying files with them they sometimes were losing file metadata (e.g. parts of the timestamps or extended attributes) without any warnings or errors.
rsync does not have such problems, it can make exact copies even when copying between different operating systems or different file systems.
Because I have stopped using both scp and sftp many years ago, I do not know whether meanwhile there was any effort to remove the bugs from scp and sftp, but I doubt it.
- tyingq 6y agoI agree rsync is better than using tar, but often I'm using that ssh/tar command line before rsync is available on the other end.
- dvdbloc 6y ago> before rsync is available on the other end. I’m curious, is this in an embedded environment or interacting with some sort of boot loader?
- regecks 6y agoNothing so drastic; I often find that Debian/Ubuntu VPS servers do not come with rsync preinstalled.
- eru 6y agoAnd rsync can be curiously slow under some circumstances.
- dredmorbius 6y agoTar can also be used with, e.g., netcat (included in busybox), useful for bootstrapping / building / rescuing systems.
- chaganated 6y agowhy the explicit rsh?
- adrian_b 6y agoThe rsync option --rsh="command_name" or -e "command_name" is required to be certain that "ssh" is used for the transfers. The rsync program might have been compiled to use "ssh" even if you do not use the --rsh= or -e options, but you cannot know this for sure (unless you have compiled it yourself and you have read the sources to verify that).
- pabs3 6y agoI suggest also adding -H (hard links) and -S (sparse files) to that command-line.