Go to file
Paolo Asperti d8a000964c
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
fix upload path
2019-04-25 21:46:33 +02:00
root/usr/bin created rpm package 2018-08-13 09:02:52 +02:00
.drone.yml fix upload path 2019-04-25 21:46:33 +02:00
COPYING created rpm package 2018-08-13 09:02:52 +02:00
README.md Added build badge 2018-08-13 09:10:41 +02:00
nethserver-usercsvimport.spec updated target release 2019-04-25 19:52:30 +02:00
test.csv manage multiple groups 2016-03-30 23:19:15 +02:00

README.md

nethserver-usercsvimport

Build Status

Batch import a lot of users and groups. You need a CSV file with this layout:

username Firstname Lastname password group1 [group2] [group3] [groupN]

See test.csv file for a sample. You can use the TAB as a separator (this is the default), or whatever character you want. Beware that Microsoft Excel uses the semicolon (;) as a separator instead the comma (,) for a CSV file (COMMA separated value).

To import, simply call the script passing the input file as STDIN or via the --file switch.

/usr/bin/usercsvimport [--file INPUTFILE] [--separator SEPARATOR] [--add_existing_users_to_groups] [--remove_users]

Some examples:

/usr/bin/usercsvimport < test.csv
/usr/bin/usercsvimport --file test.csv --separator ";"
cat test.csv | /usr/bin/usercsvimport --separator "," --add_existing_users_to_groups

You can specify a custom field separator. The import process will create all non-existing groups. If the user already exists and the "add_existing_users_to_groups" switch is NOT set, then the line is skipped (so if you specify a nonexistent group for this user, the group won't be created). If you enable "add_existing_users_to_groups" and the user is already present, the non-existing groups are created and the user is assigned to all the specified groups.

If you specify a group name which starts with a "-" (dash), then the user will be removed from that group. This feature is working even if you don't enable "add_existing_users_to_groups".

To remove users you can use the same .CSV file you used for creation, or you can provide a file with a users list (one user per line). This file will be parsed for user deletion if you specify the "--remove_users" parameter.