scp -c none (was Re: NFS client slow on amd64 6.2-PRERELEASE #2)

Diomidis Spinellis dds at aueb.gr
Mon Oct 9 08:00:47 UTC 2006


Hans Lambermont wrote:
> Diomidis Spinellis wrote:
> 
>> You can also use ports/net/socketpipe.  For example you can copy a
>> directory with:
>>
>> socketpipe -b -i { tar cf -  directory  }  -l  { ssh  remotehost }  -r
>> { tar xvf - }
> 
> Just curious, what is the advantage of this approach to the following :
> 
> tar cf - directory | ( ssh remotehost 'cd targetdir && tar xpf -' )
> 
> Something with buffering perhaps ?

The advantage is a performance gain, especially on slower machines.  You 
don't encrypt/decrypt the data, and you don't have other processes 
read/writing the data.  However, because the data is not encrypted, and 
can therefore be read and modified on transfer, the approach is only 
suitable for closed, secure networks.

With "tar cf -  dir | ssh tar xf -" your data travels as follows:

  tar   ssh            sshd   tar
   |    ^ |            ^  |    ^
   |    | |            |  |    |
   v    | v            |  v    |
+------------+     +-------------+
|local kernel|---->|remote kernel|
+------------+     +-------------+

With socketpipe, after the initial plumbing, which is performed using 
ssh, the data travels as follows:

    tar                   tar
     |                     ^
     |                     |
     v                     |
+------------+     +-------------+
|local kernel|---->|remote kernel|
+------------+     +-------------+

The two tar processes directly write to and read from a network socket 
(hence the program's name).

Diomidis - dds@ - http://www.spinellis.gr


More information about the freebsd-stable mailing list