rsync unable to sync suid files

Alex Zbyslaw xfb52 at dial.pipex.com
Fri Sep 30 07:19:25 PDT 2005


Rajarajan Rajamani wrote:

>I am running Release 5.4 with 2 disks and am using rsync to sync between the
>two. On installing the second disk I used dump/restore to mirror them and
>am since using rsync for incremental changes.
>
>However I have a problem that rsync is unable to copy some files
>and I suspect it is has something to do with the suid files.
>
>Am I missing some switch to rsync ?
>
>This is the output ----
># rsync --archive --times --verbose --delete --links --hard-links /usr/ /backup/usr
>[...]
>rsync: rename "/backup/usr/bin/.login.afaGPu" -> "bin/login": Operation not permitted (1)
>  
>

It's a problem with the schg flag (and sunlnk might be similar).  See 
man chflags.  It just so happens that suid files have been made schg to 
stop them being tampered with, but otherwise suid is just a coincidence.

% ls -lsaFko /usr/bin/login
18 -r-sr-xr-x  1 root  wheel  schg 17192 Aug  8 23:06 /usr/bin/login*

The only solutions I could think of were 1) fix rsync to be flag aware 
(hard) 2) implement something based on mtree which parsed your source 
tree, chflags -R on your dest tree, did the rsync, then ran mtree on the 
dest tree to fix the flags back.  I haven't done either yet :-( so if 
anyone has a better solution I'd love to know.  2) won't work if you run 
at higher securelevel since you can't un-schg files (because it's not 
secure :-)), IIRC.

--Alex



More information about the freebsd-questions mailing list