|
|
|
|
|
|
dlostboy (at) lostinfo (dot) com Home | Journal | Multimedia | Files | Other | Links | About |
|
|
|
FreeBSD HOWTO for setting up rsync
Ok, so you have some files that you need to keep synchronized between servers and
do not want to have to keep them up to date manually. CVS is a great option that
also gives you version control and authoring notes and blah blah blah but it is
rather time consuming to set up for the first time, and has alot of overhead for
simple tasks. We'll opt for another way of doing it...rsync.
For my examples, we'll say that you want to synchronize a directory tree containing
file1 -> file12 that need to be rather up to date and you want it to be a automated
process. We'll say for this example that they are in the directory /home/myusername/myfiles
Add the myusername to the remote machine. Create a .ssh directory in that user's home
directory and make sure nobody but myusername and root can read it. Now goto the client machine
and
Now that you have a .ssh/identity & .ssh/identity.pub (.ssh/id_rsa.pub in newer versions)
in your /home/myusername directory,
binary FTP (or other method) the "identity.pub" file to your remote machine. Place that file
in the /home/myusername/.ssh directory on the remote machine and rename the file to
"authorized_keys". It should be owned by the "myusername" and set to 600 permissions
(sshd runs as root so it's ok).
Now go back to the client machine and ssh to the remote machine. It should let you in
without a password now. If it asks you for a RSA challenge phrase, it's cause you screwed up
and typed a challenge phrase when you ssh-keygen'ed. If it asks you for a password like normal
then doublecheck that your identity.pub from the client machine is in /home/myusername/.ssh
as authorized_keys on the remote machine.
Now that you have the security set up, you just need to crontab (via /etc/crontab or "crontab -e")
the rsync job to synchronize your trees. We'll use the --delete option because we want an exact
copy...excluding this option allows files to exist on the remote machine that do not exist on the
client machine. You can man rsync for all the options, but just do a
|
| ©2000, ©2001 LostInformation |