30

scp works well in all cases, but the Raspberry Pi is to weak to copy files efficiently in a secure environment (lan). The theoretically possible 6,75 MB/s via 54 Mbit wireless lan shrink down to about 1.1 MB/s.

Is there a way to copy files remotely without encryption?

It should be a cli command with no dependencies to extra services (ftp, samba) or at least with a minimum of configuration. I mean, a standard tool that works quite well out-of-the-box with standard programms/services (like scp/ssh).

ManuelSchneid3r
  • 4,256
  • 8
  • 41
  • 58

8 Answers8

17

You might be looking for rcp, it performs remote execution via rsh so you will have to rely on that and have in mind that all communication are insecure.

Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
YoMismo
  • 4,005
  • 1
  • 15
  • 31
15

I wrote this quick script:

#!/bin/bash

ssh "$1" "nc -l 2020 > \"$2\" &"
pv "$2" | nc "$1" 2020

It takes two args, the host to send it to and the file you are sending. It only works for one file. It uses ssh to start a netcat listening on the opposite end and then uses netcat to send it to that listening port. I added pv to the start to give a nice progress bar. Replace pv with cat if you don't have or want that. Change the 2020 port to whatever you like. This requires you to have ssh access to the remote system.

This is completely insecure, but then, that's what you wanted.

Ben Collins
  • 151
  • 1
  • 2
  • Note: some versions of ``nc`` may require the receiving command to be written ``nc -l -p 2020``. – G-Man Says 'Reinstate Monica' May 04 '20 at 03:16
  • I know this comment comes late, but I’d like to point out, for me, `nc -l -p 2020` works on macOS, while `nc -l 2020` works on Linux. – remino Aug 16 '21 at 10:39
  • Recent versions of `nc` allow the receive buffer size to be specified. For better performance when moving larger amounts of data, using this option makes a big difference. For example, on Linux: `nc -l -p 2020 -I 4194304` – Stephen Balousek Jun 09 '22 at 15:17
14

You cannot disable encryption completely on ssh/scp but you can force it to use a weaker cipher that is much less cpu intensive. Make sure that compression is not turned on in your ssh_config or on the command line and add -c arcfour,blowfish-cbc to your scp command line to select weaker ciphers.

doneal24
  • 4,910
  • 2
  • 16
  • 33
  • 2
    This is a nice idea. Is this possible for host specific config? (.ssh/config) – ManuelSchneid3r Feb 03 '14 at 17:27
  • 4
    @ManuelSchneid3r: Yes: under a `Host` section in your ssh_config, use `Ciphers arcfour,blowfish-cbc` to mirror the above `-c` switch. However, if your CPUs support the AES-NI instruction set, I'd try switching to `[email protected]` (yes, that's the cipher name, including the `@` stuff), which will use the blazingly fast (with AES-NI) AES128-GCM. – Reid Feb 03 '14 at 17:51
  • I wouldn't really call blowfish a weak cipher an in general case (i.e. not R-Pi) AEs might be boosted by hw acceleration. – peterph Oct 21 '14 at 21:22
  • As of 2022 arcfour and blowfish are not usable with MacOS -> Ubuntu 21.10. – Thorbjørn Ravn Andersen Feb 27 '22 at 13:15
10

I think NFS is quite underrated for this sort of task, where you want convenience, speed and don't care about security. NFS is really simple to set up, especially on the client: see this short guide for ubuntu, together with this longer ubuntu community help page. From the client's perspective you just mount the server directory and it looks just like a local drive and you can use cp or rsync or whatever commands you want.

TooTone
  • 245
  • 2
  • 10
  • 1
    What are your experiences with what kinds of speed to expect? – Thorbjørn Ravn Andersen Jan 06 '19 at 02:16
  • 1
    @Thorbjørn Ravn Andersen for NFS using gigabit Ethernet and PCIe3 x4 SSDs I found the network was the bottleneck. Using QDR Infiniband instead of gigabit Ethernet the SSDs were the bottleneck. Linux' kernel NFS server is fairly low overhead. – Eric M Sep 25 '19 at 17:15
5

The above bash script by Ben Collins is a good solution, but he is missing the -p flag for the port on the server side. Running that as is would just give you an empty file or a hung server that never does anything.

It's easier to see what this is doing if you just look at the commands.

DestinationShell# nc -l -p 2020 > file.txt

SourceShell# cat file.txt | nc dest.ip.address 2020

nc, or netcat, is just like cat except for the output is echoed into another machine through a TCP connection. You're just pushing the output of nc on the server into the destination file. You can setup the Destination in the same way and do echo foo | nc dest.ip.address 2020 and do all sorts of other things with nc.

111---
  • 4,424
  • 3
  • 27
  • 50
4

There are patches for openssh for HPC (High Performance Computing) that improve ssh throughput by increasing transfer window sizes and disabling encryption - if you don't mind recompiling (and probably forward-porting patches), check HPN-SSH. As BowlOfRed noticed in the comment, you'd need to use the patches on both the client and the server.

You can also use rsync - on one machine as a daemon and as a simple client on the other one. It is particularly useful for synchronising larger volumes over network link that is slower than reading (and checksumming) the files, since it is able to transfer just those parts of files that differ between client and server. See rsync(1) and rsyncd.conf(5) man pages for details.

peterph
  • 30,520
  • 2
  • 69
  • 75
  • 4
    This was not explicit in your answer, but these patches include the ability to use the "none" cipher in SSH (in other words, disable encryption entirely). The drawback is that you have to apply and run it on both ends. A normal server won't accept the "none" cipher. – BowlOfRed Oct 21 '14 at 23:06
  • Very good point! – peterph Oct 22 '14 at 08:48
4

it has been some time since the last update, some ciphers have changed, and at least on freeBSD, the blowfish is no longer available. The fastest cipher I found with current ssh installations is -c aes128-cbc.

Enjoy.

Elmars
  • 41
  • 1
4

If you want to transfer entire file structures use tar.

in the receiving system:

[]# nc -l 2020 | tar xvf -

then on the sending system:

[]# tar cvf - | nc dst.hostname.net 2020

Watch the the files archive on one system and extract on the other ;)

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
user288759
  • 41
  • 1