CSV file import script in UCS Univention

Hello everyone.

I wanted to know, if it was possible to import with a CSV file, my list of users on UCS Univention. If yes, how? Without using UCS @ School of course.

Thanks to those who will help me

Have a good day.

Without @school there is no csv-based user import possible.

You might use “udm” to create users and wrap around your shell script to extract the needed values form your csv-File.

/CV

Hi christian thank you for your answer, and to import contacts but not users, is it impossible either ?

Thank you.

Hi,

first, it is not impossible. It is not implemented the way you wish. As written, create a tiny script which gets the value from your csv and feeds then udm with these values. So you will have all users created…

Second, contacts are (in terms of LDAP) users… at least somehow :smiley: So same applies.

/CV

1 Like

Here is a simple shell script that does an import from a CSV file: Csv Datei integrieren

2 Likes

It appears as if the formatting of the original post got lost during the transfer from the old forum. Especially the first examples using cat are not clear enough showing the difference of the commands and the result.

1 Like

Yeah, the migration did not handle [code] blocks properly. I’ve fixed that post manually.

1 Like

Thanks for all your answers, Troeder, do you think this technique still works to import mailing list contacts for example on UCS ?

Sure.
First create a mailing list with some contacts in the UMC (web UI).
Then look at the result on the command line: udm mail/lists list
Adapt the mentioned script to use UDM to create mailing lists:

udm mail/lists create \
    --position "cn=mailinglists,cn=mail,$(ucr get ldap/base)" \
    --set name=$NAME \
    --set mailAddress=$ADDR \
    --append members=$MEMBER1 \
    --append members=$MEMBER2 \
    --append allowedEmailGroups=$GRP1 \
    --append allowedEmailGroups=$GRP2
1 Like

Ok, but i have a ideas, when mailing lists are created via UCS, they are necessarily recorded in a file somewhere in debian? If so which one do you think?

Thanks

They are not saved on disk. Postfix queries the LDAP directly. A UDM mail/lists mailing list is really an alias like you’d find in /etc/aliases. The file that Postfix uses is /etc/postfix/ldap.virtual

1 Like

Thank you for your help. I just did the steps you told me and it works. by account the file ldap.virtual where are stored my mailing list if I’m wrong is nonexistent in my debian.

Yes, this is a Postfix integration file of UCS. It doesn’t exist in a Debian system.

1 Like

Okay, so if I want to add existing mailing lists to this file, I guess it’s impossible.

Thank’s

Hello,

sorry to reply so late - I was on vacation.

To create a mailing list, use either the command line (udm mail/lists create ...) or the UMC module: http://docs.software-univention.de/manual-4.3.html#mail::management::mailinglists
The created lists will immediately be used by Postfix, as it will find them in LDAP.

There’s a simple script now available to easily import users, group, computers etc. from a CSV file: https://github.com/univention/udm_import

Mastodon