install rsync

FreeBSD Installation tips

install rsync

Postby stephen » Sat Apr 10, 2010 6:57 pm

An article on rsync from freeos
http://www.freeos.com/articles/4042/
vi /etc/
Freebsd rsync install
cd /usr/ports/net/rsync
make install

vi /etc/rc.conf
rsyncd_enable="YES"

On the server computer
vi /usr/local/etc/rsyncd.conf
Code: Select all
uid = nobody
#gid = nobody
gid = staff
[ports_distfiles]
        path = /usr/ports/distfiles
        comment = /usr/ports/distfiles

[ports]
        path = /usr/ports
        comment = /usr/ports

[etc]

        path = /etc
        comment = /etc

[www]
        path = /usr/local/www/apache22

[local]
        path = /usr/local

[backup]
       path = /disk2/backup


vi /etc/inetd.conf
Code: Select all
rsync   stream  tcp     nowait          root    /usr/bin/rsync          rsyncd -
-daemon


# /usr/local/etc/rc.d/rsyncd start

On the client mackine you can run
Code: Select all
 rsync -avzrpog user@nahis1::ports_distfiles /usr/ports/distfiles --safe-links
rsync -avzrpog user@nahis1::www /usr/local/www/apache22 --safe-links
rsync -avzrpog user@nahis1::local/etc/apache22 /usr/local/etc/apache22 --safe-links


and this will synchronise the server /usr/ports/distfiles to the client /usr/ports/distfiles

Note if you try and use rsync as root user you will not be able to enter a valid password if the ssh system is set to prevent root logins.
see
http://blogs.sun.com/jkini/entry/how_to_scp_scp_and
Note that ssh by default does not allow root to log in. This has to be explicitly enabled on host_dest. This can be done by editing /etc/ssh/sshd_config and changing the option of PermitRootLogin from no to yes. Don't forget to restart sshd so that it reads the modified config file. Do this only if you want to use the root login.


Note. How to use rsync with out the password prompt
http://blogs.sun.com/jkini/entry/how_to_scp_scp_and
1.

On host_src, run this command as the user that runs scp/ssh/rsync

$ ssh-keygen -t rsa

This will prompt for a passphrase. Just press the enter key. It'll then generate an identification (private key) and a public key. Do not ever share the private key with anyone! ssh-keygen shows where it saved the public key. This is by default ~/.ssh/id_rsa.pub:

Your public key has been saved in <your_home_dir>/.ssh/id_rsa.pub

2.

Transfer the id_rsa.pub file to host_dest by either ftp, scp, rsync or any other method.

3.

On host_dest, login as the remote user which you plan to use when you run scp, ssh or rsync on host_src.
4.

Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys

$ cat id_rsa.pub >>~/.ssh/authorized_keys
$ chmod 700 ~/.ssh/authorized_keys

If this file does not exists, then the above command will create it. Make sure you remove permission for others to read this file. If its a public key, why prevent others from reading this file? Probably, the owner of the key has distributed it to a few trusted users and has not placed any additional security measures to check if its really a trusted user.
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

Return to FreeBSD

Who is online

Users browsing this forum: No registered users and 2 guests

cron