Difference between revisions of "Unison"

From ArchWiki
Jump to: navigation, search
(Created page with '== Summary == Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or dif…')
 
(recategorize)
(46 intermediate revisions by 13 users not shown)
Line 1: Line 1:
== Summary ==
+
[[Category:Internet applications]]
 
+
[[de:Unison]]
Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.
+
'''Unison''' is a bidirectional file synchronization tool that runs on Unix-like operating systems (including Linux, Mac OS X, and Solaris) and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. It also unrestricted in terms of which system can be the host.
 
+
Unison works on Windows, Unix ( OSX, Solaris, Linux etc.) systems and you can sync with all platforms, like Windows laptop with Unix server.
+
  
 
== Installation ==
 
== Installation ==
pacman -S unison
+
 
This provides the unsison-gtk(2) package.
+
[[pacman|Installing]] {{Pkg|unison}} from the [[official repositories]], which provides CLI, GTK+  and GTK+ 2.0 interfaces. For offline documentation install {{AUR|unison-doc}} from the [[AUR]].
  
 
== Configuration ==
 
== Configuration ==
In order to use unison you need to create an profile, you can do this the gui way or by creating an profile in .unison.
 
  
If you want to use the gui, run:
+
In order to use Unison, you need to create a profile.
unison-gtk2
+
Else edit the default config file
+
vi(m) ~/.unison/default.perf
+
  
First we define the root of what you want to sync
+
=== GUI ===
root = /home/user/
+
  
Then we define the root where we sync it too
+
To configure Unison with the GUI run:
root = ssh://example.com//path/to/server/storage
+
  $ unison-gtk2
Optional you can give arguments to ssh
+
  sshargs = -p 4000
+
  
Now we are going to define with dirs and files we want to include in the sync
+
=== Manual ===
  
 +
Alternatively, manually create a profile in {{ic|~/.unison}} and add the following lines to the default configuration file, {{ic|~/.unison/''profilename''.prf}}.
 +
 +
Define the root directory to be synchronized.
 +
root=/home/user/
 +
 +
Define the remote directory where the files should be sychronized to.
 +
root=ssh://example.com//path/to/server/storags
 +
 +
Optionally, provide arguments to [[SSH]].
 +
sshargs=-p 4000
 +
 +
Define which directories and files should be synchronized:
 
  # dirs
 
  # dirs
  path = Documents
+
  path=Documents
  path = Photos
+
  path=Photos
  path = Study
+
  path=Study
 
  # files
 
  # files
  path = .bashrc
+
  path=.bashrc
  path = .vimrc
+
  path=.vimrc
+
You can also define ignores
+
ignore = Name temp.*
+
ignore = Name .*~
+
ignore = Name *.tmp
+
  
For further references check the unison [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#profileegs documentation]
+
You can also define which files to ignore:
 +
ignore=Name temp.*
 +
ignore=Name .*~
 +
ignore=Name *.tmp
 +
 
 +
{{note|For more information see the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#profileegs Sample profiles] in the [http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html User Manual and Reference Guide].}}
  
 
== Usage ==
 
== Usage ==
When your profile is setup you can start syncing:
 
unsion <profilename>
 
Or:
 
unision-gtk2
 
And select the profile, unison has a nice interface where you can view the progress and changes.
 
  
== Other Resources ==
+
Once your profile is set up, you can start syncing:
[http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#afterinstall manual]
+
$ unison ''profilename''
[http://www.endperform.org/2007/07/howto-backup-and-sync-with-unison/ howto]
+
or using the GUI tool:
 +
$ unison-gtk2
 +
and select the profile. Unison has a nice interface where you can view the progress and changes.
 +
 
 +
== Version incompatibility ==
 +
 
 +
For Unison to function properly, the same version ''must'' be installed on all clients. If, for example, one computer has version 2.40 and the other has 2.32, they will not be able to sync with each other. This applies to ''all'' computers that share a directory to be synchronized across your machines.
 +
 
 +
Due to the staggered releases with varying Linux distros, you might be stuck with older versions of Unison, while Arch Linux has the latest upstream version in the Extra repository. There are unofficial [[PKGBUILD]]s for versions 2.32 ({{AUR|unison-232}}) and 2.27 ({{AUR|unison-227}}) on the [[AUR]] that allow users of multiple distros to continue using Unison with their existing systems.
 +
 
 +
== Tips and tricks ==
 +
 
 +
=== Save human time and keystrokes ===
 +
 
 +
If one runs unison within a VDT emulator capable of maintaining a suitable scrollback buffer, there is no purpose in having to confirm every non-conflicting change; set the {{ic|auto}} option to true to avoid these prompts.
 +
 
 +
=== Common config sync ===
 +
 
 +
When syncing configuration files which would vary (e.g., due to endemic applications, security-sensitive configuration) among systems (servers, workstations, laptops, smartphones, etc.) but nevertheless contain common constructs (e.g., key bindings, basic shell aliases), it would be apt to separate such content into separate config files (e.g., {{ic|.bashrc_common}}), and sync only these.
 +
 
 +
{{Warning|Bidirectional syncing of config files can lend itself to become an avenue for an attack, by enabling the peer syncing system to receive malicious changes to config files (and perhaps even other peers the system syncs with). This is an attractive option for adversaries, especially when the conceptual security levels of the two systems differ (e.g., public shell server vs. personal workstation), since it would likely be simpler to compromise a system of lower security. Always use the {{ic|noupdate}} option when bidirectional syncing between two particular systems is deemed unnecessary; when necessary, verify each change when syncing. Automatic bidirectional syncs should be done with extreme caution.}}
 +
 
 +
== See also  ==
 +
 
 +
{{Wikipedia|Unison (file synchronizer)}}
 +
* [http://www.cis.upenn.edu/~bcpierce/unison/ Official website]
 +
* [http://tech.groups.yahoo.com/group/unison-users Yahoo! user group]
 +
* ''[http://www.pgbovine.net/unison_guide.htm Liberation through data replication]'' by Philip Guo
 +
* ''[http://www.pgbovine.net/unison-for-your-mom.htm Setting up Unison for your mom]'' by Philip Guo
 +
* ''[http://twiki.org/cgi-bin/view/Codev/ReplicationUsingUnison Replication using Unison]'' on TWiki

Revision as of 04:31, 1 March 2014

Unison is a bidirectional file synchronization tool that runs on Unix-like operating systems (including Linux, Mac OS X, and Solaris) and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. It also unrestricted in terms of which system can be the host.

Installation

Installing unison from the official repositories, which provides CLI, GTK+ and GTK+ 2.0 interfaces. For offline documentation install unison-docAUR from the AUR.

Configuration

In order to use Unison, you need to create a profile.

GUI

To configure Unison with the GUI run:

$ unison-gtk2

Manual

Alternatively, manually create a profile in ~/.unison and add the following lines to the default configuration file, ~/.unison/profilename.prf.

Define the root directory to be synchronized.

root=/home/user/

Define the remote directory where the files should be sychronized to.

root=ssh://example.com//path/to/server/storags

Optionally, provide arguments to SSH.

sshargs=-p 4000

Define which directories and files should be synchronized:

# dirs
path=Documents
path=Photos
path=Study
# files
path=.bashrc
path=.vimrc

You can also define which files to ignore:

ignore=Name temp.*
ignore=Name .*~
ignore=Name *.tmp
Note: For more information see the Sample profiles in the User Manual and Reference Guide.

Usage

Once your profile is set up, you can start syncing:

$ unison profilename

or using the GUI tool:

$ unison-gtk2

and select the profile. Unison has a nice interface where you can view the progress and changes.

Version incompatibility

For Unison to function properly, the same version must be installed on all clients. If, for example, one computer has version 2.40 and the other has 2.32, they will not be able to sync with each other. This applies to all computers that share a directory to be synchronized across your machines.

Due to the staggered releases with varying Linux distros, you might be stuck with older versions of Unison, while Arch Linux has the latest upstream version in the Extra repository. There are unofficial PKGBUILDs for versions 2.32 (unison-232AUR) and 2.27 (unison-227AUR) on the AUR that allow users of multiple distros to continue using Unison with their existing systems.

Tips and tricks

Save human time and keystrokes

If one runs unison within a VDT emulator capable of maintaining a suitable scrollback buffer, there is no purpose in having to confirm every non-conflicting change; set the auto option to true to avoid these prompts.

Common config sync

When syncing configuration files which would vary (e.g., due to endemic applications, security-sensitive configuration) among systems (servers, workstations, laptops, smartphones, etc.) but nevertheless contain common constructs (e.g., key bindings, basic shell aliases), it would be apt to separate such content into separate config files (e.g., .bashrc_common), and sync only these.

Warning: Bidirectional syncing of config files can lend itself to become an avenue for an attack, by enabling the peer syncing system to receive malicious changes to config files (and perhaps even other peers the system syncs with). This is an attractive option for adversaries, especially when the conceptual security levels of the two systems differ (e.g., public shell server vs. personal workstation), since it would likely be simpler to compromise a system of lower security. Always use the noupdate option when bidirectional syncing between two particular systems is deemed unnecessary; when necessary, verify each change when syncing. Automatic bidirectional syncs should be done with extreme caution.

See also

Template:Wikipedia