News for hackers. Stuff that matters.
Re:Deprecating scp by lloeki on Friday November 06, 2020 @09:51AM (#25007946)
In practice many times I end up using:

    ssh cat /foo/bar > /bar/baz 
    ssh tar c /foo | tar x -C /bar
mostly because variants such as vagrant ssh or docker-machine ssh, cross-product with the remote target being any weird platform like solaris or a limited busybox or has sftp disabled
Re:Deprecating scp by jcranmer on Friday November 06, 2020 @11:07AM (#25008621)
In practice, tar c | ssh tar x can actually be far faster than scp -r, especially when you have a lot of small files.
Re:Deprecating scp by sethhochberg on Friday November 06, 2020 @03:26PM (#25010796)
I've found many people either forget (or never knew) that pipes have a buffer, and that buffers are very useful when you are dealing with potentially bursty throughput.

In a previous team where we dealt with shipping around lots of ZFS snapshots (where both the performance of reading from disk can vary based on the ARC and filesystem metadata) and occasionally using VPN tunnels on public internet links, pv to get even larger pipe buffers than standard was often a huge performance equalizer. Readers read as fast as they can, writers write as fast as they can, and the buffer massages any variability in the middle.

https://linux.die.net/man/1/pv

Re:Deprecating scp by saltcured on Friday November 06, 2020 @04:07PM (#25011160)
It's not just the buffer, it is the PIPE. Specifically, pipelining that streams one file after another, without an idle period of waiting for the round-trip acknowledgements of one file receipt prior to sending the next. Using rsync over ssh has the same massive benefit for transferring many files, even if there is no existing data to make use of its differential transfer mechanisms.

(Those extra mechanisms are usually beneficial in WAN scenarios as well, except when you have high speed links, in which case blasting the full files may be faster than doing the IO to figure out comparisons and skip transfer.)

Edited: adjusted confused punctuation.

Re:Deprecating scp by edgyquant on Friday November 06, 2020 @01:16PM (#25009811)
I’ve also used

   dd if=filename | ssh hostname dd of=remote_filename
Quite a bit
Re:Deprecating scp by jrumbut on Friday November 06, 2020 @02:53PM (#25010562)
There's something a little badass about using dd to transfer a file to a remote system.
Re:Deprecating scp by asveikau on Friday November 06, 2020 @11:57PM (#25013301)
I was transferring files to an Android device, and adb push wasn't working for some reason. It would hit an error and kill the adb connection until I re-plugged the USB.

Somehow this worked:

    dd if=foo | adb shell dd of=/storage/.../foo
Re:Deprecating scp by schoen on Friday November 06, 2020 @03:21PM (#25010770)
Everything is a file!
Re:Deprecating scp by lloeki on Friday November 06, 2020 @04:28PM (#25011358)
Ah yes, that one too. Used it a couple of times straight with a /dev/sda to best effort salvage data from a broken but running remote system I knew would not reboot as is.
Re:Deprecating scp by a1369209993 on Friday November 06, 2020 @03:29PM (#25010830)
Huh, pleasantly surprised to learn that dd correctly handles the truncated final block of a not-multiple-of-512-byte file; could have sworn that didn't work at some point.
Re:Deprecating scp by dfox on Saturday November 07, 2020 @03:53AM (#25013912)
SUS specifies that dd should do the "right thing" with input with non-integer number of blocks input, that is pad it with zeros if conv=sync, just pass through shorter otherwise.
Re:Deprecating scp by a1369209993 on Saturday November 07, 2020 @12:36PM (#25016627)
> SUS specifies that dd should do the "right thing"

A example the C standard could stand to learn from, then.

Re:Deprecating scp by drran on Saturday November 07, 2020 @04:36AM (#25014083)
Why not just

  cat file | ssh user@host 'cat >file'
  ssh user@host cat file | cat >file
?

PS.

I use mc to copy: F5, Enter.

Re:Deprecating scp by edgyquant on Sunday November 08, 2020 @09:23PM (#25030842)
Cause when I younger I didn’t know how to pipe like that and dd just worked. It’s kinda stuck with me and there isn’t much a different imo