Csync – Client only bidirectional file synchronizer
It synchronizes bidirectionally and allows the user to keep two copies of files and directories in sync. csync uses widely adopted protocols, such as smb or sftp, so that there is no need for a server component. It is a user-level program which means you don’t need to be a superuser or administrator.
Together with a Pluggable Authentication Module (PAM), the intent is to provide Roaming Home Directories for Linux.
What is the difference between rsync and csync
rsync is a unidirectional file synchronizer or simply a backup tool. It requires rsync on the host you’re syncing with to use the rsync protocol. As rsync is backup tool (one way) it isn’t able to correctly detect file deletions for example.
Install csync in ubuntu
Open the terminal and run the following commands
sudo add-apt-repository ppa:markhannon/ppa
sudo apt-get update
sudo apt-get install csync
Using csync commandline client
The synopsis of the commandline client is
csync [OPTION...] SOURCE DESTINATION
It synchronizes the content of SOURCE with DESTINATION and vice versa. The DESTINATION can be a local directory or a remote file server.
csync /home/csync scheme://user:password@server:port/full/path
To synchronize two local directories:
csync /home/csync/replica1 /home/csync/relplica2
Two synchronizer a local directory with an smb server, use
csync /home/csync smb://rupert.galaxy.site/Users/csync
If you use kerberos, you don’t have to specify a username or a password. If you don’t use kerberos, the commandline client will ask about the user and the password. If you don’t want to be prompted, you can specify it on the commandline:
csync /home/csync smb://csync:[email protected]/Users/csync
If you use the sftp protocol and want to specify a port, you do it the following way:
csync /home/csync sftp://[email protected]:2222/home/csync
The remote destination is supported by plugins. By default csync ships with smb and sftp support. For more information, see the manpage of csync.
csync provides exclude lists with simple shell wildcard patterns. There is a global exclude list, which is normally located in /etc/csync/csync_exclude.conf and it has already some sane defaults. If you run csync the first time, it will create an empty exclude list for the user. This file will be ~/.csync/csync_exclude.conf. If you run both files are used and maybe an additional one if you specify it.
The entries in the file are newline separated. Use /etc/csync/csync_exclude.conf as an example.