Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2005 15:19:21 +0100
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        Rajarajan Rajamani <rajarajan@comcast.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: rsync unable to sync suid files
Message-ID:  <433D4969.1060900@dial.pipex.com>
In-Reply-To: <20050930140639.GA7111@rajarajan.homeunix.net>
References:  <20050930140639.GA7111@rajarajan.homeunix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?433D4969.1060900>