Synchronize two folders on a Mac and other Unix Systems with csync

I’ll show you how to to synchronise files of two different directories in a terminal using a mighty automator. The tool is called csync and is a client side file synchronizer. Unless like rsync it syncs in two directions so that the contents are equal as soon as it finished.

Here is the simple example of syncing two folders from terminal:

csync /path/to/folder1 /path/to/folder2

If you run it the first time, this line compares the both directories and copies the files missing in each other directory to the opposite side. So in the end they are equal. If you delete a file in folder1 it and run it again, csync will notice that the file has been deleted in folder1 and will delete it in folder2. If you create a new file in folder2 and run csync, it will copy the new file to folder2. If a file has changed it will detect it and copy the file to the other folder. If a file has been changed on both sides, the newer file wins.

The options are pretty simple and don’t need further documentation here. The only interesting option is an additional exclude list. The default one can be found in ‘~/.csync/csync_exclude.conf’.

You can always check the manual of Rsync by typing “man csync” in terminal.

The current stable version supports the SMB (Windows sharing) protocol and SFTP.

If you want to synchronize a local folder with a folder on another unix machine you can use the following command:

csync /path/to/my/music/collection sftp://my.notebook/home/me/my/music/collection

and it will do the same as stated above, but over a sftp network connection. SFTP is the file transfer protocol which is based on SSH and every Unix machine has it normally enabled by default.

We are currently improving csync and adding support for OwnCloud. A graphical Qt based frontend for csync is mirall.

This post is inspired by this one 😉

csync at FOSDEM

I’m currently updating csync to work with libssh 0.4 and I will give a lightning talk about csync at FOSDEM next weekend. csync is a file synchronizer to keep two folders in sync. This can be local or remote. The main purpose of csync is to provide Roaming Home Directories.

I will work with Aris on libssh stuff and try to get some small features in KDE for kio_sftp. I heard that some KDE guys are around too. I hope to see you there.

If you’re a Samba developer and go to FOSDEM, let me know 🙂

csync and pam_csync 0.42.0 beta1

I’ve released a new version of csync and pam_csync. csync is a bidirectional file synchronizer for Linux and allows to keep two copies of files and directories in sync. It uses uses widly adopted protocols like smb or sftp so that there is no need for a server component of csync. It is a user-level program which means there is no need to be a superuser. With pam_csync it is possible to create roaming home directories.

This version fixes several bugs to increase the stability of the file synchronizer. It provides a new plugin to synchronize two replicas with the sftp protocol. To get the csync sftp plugin working you need libssh 0.2 with the following two patches:

Map permission fields
Errno mapping

The libssh package in the network:synchronization:files project in the build service has these two patches. The csync version of the BS project provides a csync-plugin-sftp package.

Packages for Fedora 9, openSUSE and SUSE Linux Enterprise 10 can be downloaded here.

More information at

Roaming Home Directories for Linux

An interesting feature of Active Directory is Roaming Profiles. You can login on different workstations and you have all you data with you. If you use a Notebook you have the same and the ability to work offline. As soon as you’re connected to you network again the data will be automatically synchronized again and you have a backup of your data.

Now the time has come to introduce Roaming Home Directories for Linux. Yesterday I’ve released a new version of csync and the first version of pam_csync. With both components you’re able to use an Active Directory environment to share your data between workstation and notebooks and work offline.

Currently only the SMB protocol is supported but I will write more plugins for other protocols in future. I have sftp and rsync (if doable) in mind. So you will be able to use it at home with you’re small NAS or in a Linux only company environment.

This is not the only use case. If you have a USB disk with your music collection. You can can attach it to PC1 and synchronize it with your local collection. Go to the next computer and synchronize it there again. As csync is a bidirectional file synchronizer the collection on PC1 and PC2 will be the same.

csync 0.42.0 alpha1

I’ve released the first alpha version of csync. csync is a client only bidirectional file synchronizer. You can use csync for different things. The intention is to provide Roaming Home Directories for Linux but you can use it to synchronize your music collection or create a backup of a directory. This is *not* intended for production environments and is designed for testing purposes only. This version is fully functional and you can sync two local directories or a local directory with a samba share.

More at