Sync files locally?

Paul Schmehl pauls at utdallas.edu
Thu Sep 28 17:35:37 PDT 2006


--On September 28, 2006 9:33:39 AM +0200 Erik Norgaard 
<norgaard at locolomo.org> wrote:
>
> 1) rsync changes behaviour depending on whether or not you include a
> trailing / from the man-page:
>
>         rsync -av /src/foo /dest
>         rsync -av /src/foo/ /dest/foo
>
That I know.

> works the same way, (and sync locally in this example). Read the man
> page, there are lots of examples.
>
> 2) The options -t and -p preserve time and permissions respectively.
> Ownership will always change to the user running rsync unless you run as
> root. This has nothing to do with rsync, you can't run chown as an
> ordinary user.
>
> You can preserve the group if you're in that group on the destination
> host.
>
> 3) The files you are syncing - should they be writeable by www? For
> security, you may really want something like this:
>
>    -rw-r----- user:www    file
>
They're user:www, but the user isn't me.  :-)

I could go into the reasons for that, but it doesn't really matter.

> and have user do the rsync. If you really need to have www write to the
> file, set group permissions +w.
>
No, I don't need that and don't want it either.  The owners of the site 
own the files, and I know how to use sudo.  :-)
>
> IIRC to run rsync over ssh the user doing the syncing must have shell
> access, running your sync as root is not desirable, it MAY be preferred
> to have it run as www to preserve owner also, at least you can restrict
> access for www.
>
I use ssh with keys so I can cron the job, but I'll have to do the extra 
step of fixing perms and ownership after copying the rsynced files over. 
No big deal.  I'll script that as well.

Paul Schmehl (pauls at utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


More information about the freebsd-questions mailing list