Much has been said about using scp being outdated and how rsync should be preferred over scp, but sometimes I just want `scp -3 host1:stuff host2:stuff`.

· · Web · 5 · 1 · 2

@evilham yep, there's nothing wrong with scp when you just want to copy some files imho. although i prefer sftp most of the time, but that's just because of the UI.

@evilham interesting. My first thought was "oh a force ipv3 switch" 😁
Then I looked up the manpage

-3 Copies between two remote hosts are
transferred through the local host.
Without this option the data is copied
directly between the two remote hosts.
Note that this option disables the
progress meter.

Why would you want to have transfers via your localhost though 🤔 isn't direct transfer faster?
Or does that need some prior complicated auth setup?

@aslmx: Sometimes you don't have the host key of host B on host A and in fast enough networks, using `scp -3` is way faster than to first get the proper host key into the proper `known_hosts` file. I usually use this for quick'n'dirty copying of tiny files like `.screenrc` to hosts not yet managed with Ansible, etc.

And sometimes, host A and host B just don't see each other, maybe because of overzealous firewalls or because one host is IPv4-only and another one is -only.

@xtaran yeah I thought about that.

For small files every now and then it's probably easier and not much slower.

@aslmx IPv3? :-D That's a good brain trick.

Copying between different remote hosts works without `-3` only if there is already some auth mechanism set up (e.g. with ~/.ssh/config in origin host).
This is something I avoid to keep this risk low:

So, yeah :-D sometimes you do want `-3`.

@evilham yeah usually -4 and -6 force ipv4 or ipv6 😁

@evilham Last time I looked rsync needed some perl on the remote server... there are many scp-capable implementations that don't have perl

@evilham: `rsync` also fails greatly on block devices. (Must though admit, that I'm not sure if `scp` can do that better. I always use `dd` over `ssh` instead of `scp` for that. 😃)

There's also ( to sync block devices. Despite the name it is more like ("transferring only the parts that have changed") than like .

@xtaran X'D dd over ssh! That's both terrible and genius. I've been using zfs send /receive over ssh a lot, which is not that much different in concept, but nicer when it's available :-D.

@evilham: I especially like dd's `status=progress` in such cases. It's available at least in all sufficiently recent versions of GNU's .

@viktormadarasz it's valid, just remember that `-T` was added for a reason :-).

Sign in to participate in the conversation – a Fediverse instance for & by the Chaos community