I'm trying to synchronize a particularly troublesome directory structure on
a SunOS box to a PC. I really want all symbolic links resolved to real files on
the PC when everything is done. I can't seem to find any combination of
parameters that will accomplish this.
It boils down to two problems.
1. It seems like that even if I exclude a symbolic link that is a directory it
is not excluded.
2. It seems like copy-links and copy-unsafe-links don't work for symbolic
links to directories outside the source tree.
Is this the correct behavior or am I doing something wrong.
Any input is greatly appreciated.
Here is my rsyncd.conf file...
-----------------------------------
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
uid = kminder
gid = svrtech
[test]
path = /home/kminder/rsync/test
comment = test
read only = yes
list = yes
-----------------------------------
Below is a simplified source structure on the unix side (source).
Note the .rel symlink and the .abs symlink.
-----------------------------------
/home/kminder/rsync> ls -al outside test
outside:
total 16
drwxr-xr-x 2 kminder g904 4096 Dec 13 11:37 .
drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 ..
-rw-r--r-- 1 kminder g904 15 Dec 13 11:37 file
test:
total 24
drwxr-xr-x 3 kminder g904 4096 Dec 13 11:36 .
drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 ..
lrwxrwxrwx 1 kminder g904 27 Dec 13 11:36 .abs ->
/home/kminder/rsync/outside
lrwxrwxrwx 1 kminder g904 3 Dec 13 11:34 .rel -> dir
lrwxrwxrwx 1 kminder g904 9 Dec 13 11:36 absfile -> .abs/file
drwxr-xr-x 2 kminder g904 4096 Dec 13 11:34 dir
-rw-r--r-- 1 kminder g904 10 Dec 13 11:32 file
lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 link -> file
lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 linklink -> link
lrwxrwxrwx 1 kminder g904 9 Dec 13 11:35 relfile -> .rel/file
-----------------------------------
I'm trying for the following structure on the pc (cygwin ls -al).
Note that all links should be resolved.
I want the duplicate files.
-----------------------------------
drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 .
drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 ..
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 file
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 link
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 absfile
-----------------------------------
When I execute the command that I think should accomplish this...
D:\sync>rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links
--exclude .rel --exclude .abs kminder@usunnbd25::test d:\sync
The resulting output follows...
-----------------------------------
receiving file list ...
readlink absfile: No such file or directory
7 files to consider
./
dir/
dir/file
14 100% 0.00kB/s 0:00:00
file
10 100% 9.77kB/s 0:00:00
link
10 100% 9.77kB/s 0:00:00
linklink
10 100% 9.77kB/s 0:00:00
relfile
14 100% 13.67kB/s 0:00:00
wrote 190 bytes read 465 bytes 187.14 bytes/sec
total size is 58 speedup is 0.09
rsync error: partial transfer (code D:\sync>dir23) at
/tmp/rsync-2.5.5/main.c(926)
-----------------------------------
My disk ends up looking as follows. Again using cygwin ls -al.
-----------------------------------
drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 .
drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 ..
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 .rel
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 file
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 link
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile
-----------------------------------
If I do it without the excludes like this...
rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links
kminder@usunnbd25::test d:/sync
The output is this...
-----------------------------------
receiving file list ...
readlink .abs: No such file or directory
readlink absfile: No such file or directory
9 files to consider
./
dir/
dir/file
14 100% 0.00kB/s 0:00:00
file
10 100% 9.77kB/s 0:00:00
link
10 100% 9.77kB/s 0:00:00
linklink
10 100% 9.77kB/s 0:00:00
relfile
14 100% 13.67kB/s 0:00:00
wrote 174 bytes read 540 bytes 204.00 bytes/sec
total size is 72 speedup is 0.10
rsync error: partial transfer (code 23) at /tmp/rsync-2.5.5/main.c(926)
-----------------------------------
My PC filesystem looks the same as it did above.
First question: must you use an rsync daemon on the Unix side? Rsh or Ssh is a lot easier. If you do need to use it, you need to know that the original intention of rsync modules was to only permit files under that module to be accessible. With the default "use chroot = yes" option, rsync chroot's to the directory so no files outside of the top path can be reached. Long ago I added the "use chroot = no" option so an rsync daemon could be run under a non-root user id (because only root can run chroot()), but even then it goes through pains to filter out paths that attempt to go outside of the top module. However, I believe, but am not sure, that if --copy-links is used with "use chroot = no" it should pull in files pointed to by symlinks from outside the top. Try it out. - Dave Dykstra On Fri, Dec 13, 2002 at 01:44:30PM -0500, Kevin Minder wrote:> I'm trying to synchronize a particularly troublesome directory structure on a SunOS box to a PC. I really want all symbolic links resolved to real files on the PC when everything is done. I can't seem to find any combination of parameters that will accomplish this. > > It boils down to two problems. > 1. It seems like that even if I exclude a symbolic link that is a directory it is not excluded. > 2. It seems like copy-links and copy-unsafe-links don't work for symbolic links to directories outside the source tree. > > Is this the correct behavior or am I doing something wrong. > Any input is greatly appreciated. > > Here is my rsyncd.conf file... > ----------------------------------- > motd file = /etc/rsyncd.motd > log file = /var/log/rsyncd.log > pid file = /var/run/rsyncd.pid > uid = kminder > gid = svrtech > > [test] > path = /home/kminder/rsync/test > comment = test > read only = yes > list = yes > ----------------------------------- > > Below is a simplified source structure on the unix side (source). > Note the .rel symlink and the .abs symlink. > > ----------------------------------- > /home/kminder/rsync> ls -al outside test > outside: > total 16 > drwxr-xr-x 2 kminder g904 4096 Dec 13 11:37 . > drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 .. > -rw-r--r-- 1 kminder g904 15 Dec 13 11:37 file > > test: > total 24 > drwxr-xr-x 3 kminder g904 4096 Dec 13 11:36 . > drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 .. > lrwxrwxrwx 1 kminder g904 27 Dec 13 11:36 .abs -> /home/kminder/rsync/outside > lrwxrwxrwx 1 kminder g904 3 Dec 13 11:34 .rel -> dir > lrwxrwxrwx 1 kminder g904 9 Dec 13 11:36 absfile -> .abs/file > drwxr-xr-x 2 kminder g904 4096 Dec 13 11:34 dir > -rw-r--r-- 1 kminder g904 10 Dec 13 11:32 file > lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 link -> file > lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 linklink -> link > lrwxrwxrwx 1 kminder g904 9 Dec 13 11:35 relfile -> .rel/file > ----------------------------------- > > I'm trying for the following structure on the pc (cygwin ls -al). > Note that all links should be resolved. > I want the duplicate files. > > ----------------------------------- > drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 . > drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 .. > drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 file > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 link > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink > -rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile > -rw-r--r-- 1 kminder None 14 Dec 13 11:34 absfile > ----------------------------------- > > When I execute the command that I think should accomplish this... > D:\sync>rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links --exclude .rel --exclude .abs kminder@usunnbd25::test d:\sync > The resulting output follows... > > ----------------------------------- > receiving file list ... > readlink absfile: No such file or directory > 7 files to consider > ../ > dir/ > dir/file > 14 100% 0.00kB/s 0:00:00 > file > 10 100% 9.77kB/s 0:00:00 > link > 10 100% 9.77kB/s 0:00:00 > linklink > 10 100% 9.77kB/s 0:00:00 > relfile > 14 100% 13.67kB/s 0:00:00 > wrote 190 bytes read 465 bytes 187.14 bytes/sec > total size is 58 speedup is 0.09 > rsync error: partial transfer (code D:\sync>dir23) at /tmp/rsync-2.5.5/main.c(926) > ----------------------------------- > > My disk ends up looking as follows. Again using cygwin ls -al. > > ----------------------------------- > drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 . > drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 .. > drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 .rel > drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 file > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 link > -rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink > -rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile > ----------------------------------- > > If I do it without the excludes like this... > rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links kminder@usunnbd25::test d:/sync > The output is this... > > ----------------------------------- > receiving file list ... > readlink .abs: No such file or directory > readlink absfile: No such file or directory > 9 files to consider > ../ > dir/ > dir/file > 14 100% 0.00kB/s 0:00:00 > file > 10 100% 9.77kB/s 0:00:00 > link > 10 100% 9.77kB/s 0:00:00 > linklink > 10 100% 9.77kB/s 0:00:00 > relfile > 14 100% 13.67kB/s 0:00:00 > wrote 174 bytes read 540 bytes 204.00 bytes/sec > total size is 72 speedup is 0.10 > rsync error: partial transfer (code 23) at /tmp/rsync-2.5.5/main.c(926) > ----------------------------------- > > My PC filesystem looks the same as it did above. > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html >
I haven't seen an answer to this, so I'll get the part I can.
You haven't overridden the default for "use chroot", which is
"yes". Thus,
you can't get the things from outside your module. In fact, rsync
explicitely ignores symlinks pointing out of the module unless use chroot
= no.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
use chroot
If "use chroot" is true, the rsync server will chroot
to the "path" before starting the file transfer with
SunOS 5.8 Last change: 12 Feb 1999 3
Standards, Environments, and Macros rsyncd.conf(5)
the client. This has the advantage of extra protection
against possible implementation security holes, but it
has the disadvantages of requiring super-user
privileges and of not being able to follow symbolic
links outside of the new root path when reading. When
"use chroot" is false, for security reasons symlinks
may only be relative paths pointing to other files
within the root path, and leading slashes are removed
from absolute paths. The default for "use chroot" is
true.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I can't address your first concern. but this handles the second.
Tim Conway
conway.tim@spilihp.com reorder name and reverse domain
303.682.4917 office, 303.921.0301 cell
Philips Semiconductor - Longmont TC
1880 Industrial Circle, Suite D
Longmont, CO 80501
Available via SameTime Connect within Philips, caesupport2 on AIM
"There are some who call me.... Tim?"
"Kevin Minder" <kevin.minder@oracle.com>
Sent by:
rsync-admin@lists.samba.org
12/13/02 11:44 AM
To: <rsync@lists.samba.org>
cc: (bcc: Tim Conway/LMT/SC/PHILIPS)
Subject: Problem with absolute symbolic links
Classification:
I'm trying to synchronize a particularly troublesome directory structure
on a SunOS box to a PC. I really want all symbolic links resolved to real
files on the PC when everything is done. I can't seem to find any
combination of parameters that will accomplish this.
It boils down to two problems.
1. It seems like that even if I exclude a symbolic link that is a
directory it is not excluded.
2. It seems like copy-links and copy-unsafe-links don't work for symbolic
links to directories outside the source tree.
Is this the correct behavior or am I doing something wrong.
Any input is greatly appreciated.
Here is my rsyncd.conf file...
-----------------------------------
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
uid = kminder
gid = svrtech
[test]
path = /home/kminder/rsync/test
comment = test
read only = yes
list = yes
-----------------------------------
Below is a simplified source structure on the unix side (source).
Note the .rel symlink and the .abs symlink.
-----------------------------------
/home/kminder/rsync> ls -al outside test
outside:
total 16
drwxr-xr-x 2 kminder g904 4096 Dec 13 11:37 .
drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 ..
-rw-r--r-- 1 kminder g904 15 Dec 13 11:37 file
test:
total 24
drwxr-xr-x 3 kminder g904 4096 Dec 13 11:36 .
drwxr-xr-x 5 kminder g904 4096 Dec 13 11:29 ..
lrwxrwxrwx 1 kminder g904 27 Dec 13 11:36 .abs ->
/home/kminder/rsync/outside
lrwxrwxrwx 1 kminder g904 3 Dec 13 11:34 .rel -> dir
lrwxrwxrwx 1 kminder g904 9 Dec 13 11:36 absfile -> .abs/file
drwxr-xr-x 2 kminder g904 4096 Dec 13 11:34 dir
-rw-r--r-- 1 kminder g904 10 Dec 13 11:32 file
lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 link -> file
lrwxrwxrwx 1 kminder g904 4 Dec 13 11:33 linklink -> link
lrwxrwxrwx 1 kminder g904 9 Dec 13 11:35 relfile -> .rel/file
-----------------------------------
I'm trying for the following structure on the pc (cygwin ls -al).
Note that all links should be resolved.
I want the duplicate files.
-----------------------------------
drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 .
drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 ..
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 file
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 link
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 absfile
-----------------------------------
When I execute the command that I think should accomplish this...
D:\sync>rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links
--exclude .rel --exclude .abs kminder@usunnbd25::test d:\sync
The resulting output follows...
-----------------------------------
receiving file list ...
readlink absfile: No such file or directory
7 files to consider
./
dir/
dir/file
14 100% 0.00kB/s 0:00:00
file
10 100% 9.77kB/s 0:00:00
link
10 100% 9.77kB/s 0:00:00
linklink
10 100% 9.77kB/s 0:00:00
relfile
14 100% 13.67kB/s 0:00:00
wrote 190 bytes read 465 bytes 187.14 bytes/sec
total size is 58 speedup is 0.09
rsync error: partial transfer (code D:\sync>dir23) at
/tmp/rsync-2.5.5/main.c(926)
-----------------------------------
My disk ends up looking as follows. Again using cygwin ls -al.
-----------------------------------
drwxr-xr-x+ 4 kminder None 4096 Dec 13 11:36 .
drwxrwxrwx+ 14 Administ Administ 8192 Dec 13 11:20 ..
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 .rel
drwxr-xr-x+ 2 kminder None 0 Dec 13 11:34 dir
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 file
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 link
-rw-r--r-- 1 kminder None 10 Dec 13 11:32 linklink
-rw-r--r-- 1 kminder None 14 Dec 13 11:34 relfile
-----------------------------------
If I do it without the excludes like this...
rsync -rptgDvP --port=34343 --copy-links --copy-unsafe-links
kminder@usunnbd25::test d:/sync
The output is this...
-----------------------------------
receiving file list ...
readlink .abs: No such file or directory
readlink absfile: No such file or directory
9 files to consider
./
dir/
dir/file
14 100% 0.00kB/s 0:00:00
file
10 100% 9.77kB/s 0:00:00
link
10 100% 9.77kB/s 0:00:00
linklink
10 100% 9.77kB/s 0:00:00
relfile
14 100% 13.67kB/s 0:00:00
wrote 174 bytes read 540 bytes 204.00 bytes/sec
total size is 72 speedup is 0.10
rsync error: partial transfer (code 23) at /tmp/rsync-2.5.5/main.c(926)
-----------------------------------
My PC filesystem looks the same as it did above.
--
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html