rsync via restricted ssh command=

Mark Constable markc at renta.net
Thu Jun 3 04:18:36 MDT 2010


I've read a few tutorials about how to use rsync via ssh using the
command= functionality to restrict where the user can sync to. I've
got this on the on the destination side in it's ~/.ssh/authorized_keys...

command="rsync --server -vvnlogDtpre.iLsf --timeout=999 . bkp",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAetc

I've tried variations of the above but I basically get this error...

% rsync -avv --delay-updates --delete-after /path/to/files/ remote:bkp
opening connection using: ssh remote rsync --server -vvlogDtpre.iLsf --delete-after --delay-updates . bkp 
building file list ... 
3 files to consider
delta-transmission enabled
./
^CKilled by signal 2.
rsync error: unexplained error (code 255) at rsync.c(543) [sender=3.0.7]

after waiting for a few minutes at the ./ for 2 simple 20 bytes test
files to transfer I finally hit ctrl-c. On the destination side there
are two rsync processes before the ctrl-c...

remote% px rsync
admin    25537  0.0  0.0  11096   940 ?        Ss   17:49   0:00 rsync --server -vvnlogDtpre.iLsf --delete-after --delay-updates . bkp
admin    25538  0.0  0.0  11096   380 ?        S    17:49   0:00 rsync --server -vvnlogDtpre.iLsf --delete-after --delay-updates . bkp

Is it obvious that I am doing something wrong, or how can I determine
what the "unexplained error (code 255)" might be, or does anyone know
of a reliable tutorial outlining how to do this please?

If I remove the command="rsync" part from the remote ends authorized_keys
then I can successfully transfer files using exactly the same source
rsync command, so it's not wrong perms or keys etc, for example...

% rsync -avv --delay-updates --delete-after --progress --stats /path/to/files/ remote:bkp
opening connection using: ssh remote rsync --server -vvlogDtpre.iLsf --delete-after --delay-updates . bkp 
building file list ... 
3 files to consider
delta-transmission enabled
./
testfile
          12 100%    0.00kB/s    0:00:00 (xfer#1, to-check=1/3)
testfile2
          13 100%   12.70kB/s    0:00:00 (xfer#2, to-check=0/3)
total: matches=0  hash_hits=0  false_alarms=0 data=25

rsync[26335] (sender) heap statistics:
  arena:         270336   (bytes from sbrk)
  ordblks:            1   (chunks not in use)
  smblks:             4
  hblks:              2   (chunks from mmap)
  hblkhd:        532480   (bytes from mmap)
  allmem:        802816   (bytes from sbrk + mmap)
  usmblks:            0
  fsmblks:          208
  uordblks:      211632   (bytes used)
  fordblks:       58704   (bytes free)
  keepcost:       58496   (bytes in releasable chunk)
deleting in .

Number of files: 3
Number of files transferred: 2
Total file size: 25 bytes
Total transferred file size: 25 bytes
Literal data: 25 bytes
Matched data: 0 bytes
File list size: 67
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 206
Total bytes received: 53

sent 206 bytes  received 53 bytes  172.67 bytes/sec
total size is 25  speedup is 0.10

--markc


More information about the rsync mailing list