Node Director
sfidirector copy
Shell Commands


sfidirector copy [-m] [-t] [-f] [-s subtree] [-d subtree] source1 [...] [:transform[:options]] destination


The copy command copies a set of records from one or more data sources into one data destination. During copy it can also process/convert the data set using merge and transform operations.

Modes of Operation

Copy can operate in different modes. However, this modes are less strictly separated than the paragraphs below seem to imply, by applying the options copy understands modes can be mixed.


When not specifying any further options all the source records from the data sources are collected and written to the destination database. Existing records are not overwritten.

Overwrite and Truncate

With the -f option set existing records in the destination database are overwritten if the DN of a source record is identical with the DN of a destination record.

The -t option makes copy clear ("truncate") the destination database before copying the new records in. Thus, the destination database after copy with -t option set contains exactly the records copied in.

Use the -t option carefully since it will delete destination database records unrecoverably.

Merge and Transform

With the -m option set source records are rather merged than concatenated. This means that records with the same key (same DN) are combined together in order to form one single resulting record. This is usually used in order to combine multiple data sources that all have part of the data, like e.g. /etc/passwd and /etc/shadow.

In the merge mode copy also allows Transformers to be applied. Transform operations are requested by inserting an argument starting with a ':' followed by the name of a transformer. Optionally, the name of the transformer may be followed by another colon and a comma-separated list of options to pass to the transformer. Transform operations may be inserted between or after source database specifiers. They operate on the data set read so far.


Truncate (clear) destination database before adding the new records
Force overwriting records in the destination database
Merge source records
-s subtree
Set the root DN of the records that should be read from the source database(s). Records outside the specified subtree are ignored.
-d subtree
Set the root DN where the records should be added in the destination database. Records are added below the specified subtree (which must exist beforehand)
a database URI specifying a source database
a database URI specifying a target database
a database URI specifying a target database
a transform operation specification including a transformer and (optionally) options to pass to this transformer


% sfidirector copy hostsfile:stdio: directory:Hosts somehost somealias

Reads records in "host file" format from standard in and adds the resulting records into the hosts tree of the database. After this operation a host named somehost with IP address and alias somealias will exist in the hosts database.

% sfidirector copy -m passwdfile:file:/etc/passwd \
shadowfile:file:/etc/shadow sambapasswdfile:file:/etc/samba/smbpasswd \

Reads records from /etc/passwd, /etc/shadow and /etc/samba/smbpasswd in the respective formats, merges the read records so that the resulting user objects contain the information from the three files and inserts the result into the people database. Note that this operation might well fail due to incomplete/partial records when the passwd, shadow and smbpasswd files are not completely in sync. Thus, the example translated into the real world would rather look like

% sfidirector copy -m -t passwdfile:file:/etc/passwd \
shadowfile:file:/etc/shadow sambapasswdfile:file:/etc/samba/smbpasswd \
% vi /tmp/userrecords # edit the records
% sfidirector copy ldiffile:file:/tmp/userrecords directory:People
% sfidirector copy -m -t directory:People :Config :AutoHome:Parent=/home \

Will read all user records from the people database, expand class information, translate the user records into automounter entries for an auto.home automounter map and finally write the records in automounter file format to /etc/auto.home.