how to export all FreeIPA users list to a csv format?
5,620
This command worked for me:
ipa user-find --all | grep -E "User Login|First|Last|UID|Email" > IPA_RAW.txt
after that, use this perl line to convert the format:
perl -ne 'chomp; print $_ . (($. % 8) ? "," : "\n")' IPA_RAW.txt | awk "Add your filters here" > users-list.csv
thanks
Related videos on Youtube
![sanjayparmar](https://i.stack.imgur.com/tvN5p.jpg?s=256&g=1)
Author by
sanjayparmar
Updated on September 18, 2022Comments
-
sanjayparmar almost 2 years
How can export all FreeIPA users to a csv file?
-
natxo asenjo almost 6 yearsnone that I know of, but quite simple to roll your own with some basic scripting.
-
natxo asenjo almost 6 yearsindeed, two minutes with a shell in a host with the ipa-admin tools installed: ipa user-find | grep login | awk ' {print $NF}' | awk '{printf "%s,",$0} END {print ""}' and I get a comma separated listi of user names. Dumping this to a file and retrieving more than 100 records will be left as an exercise for the reader ;-)
-
natxo asenjo almost 6 yearsbut using Apache Directory Studio (a ldap browser) you can do just that, Select the part of the tree you need, and export it to csv, it works
-
sanjayparmar almost 6 years@natxoasenjo Thanks for your update. I tried same way but I am missing something. I want show in like First Name, Last Name, Email, Mobile. format.
-
sanjayparmar almost 6 yearsif you try with- ipa user-find --all | grep -E "First|Last|Email" you will get result like. First name: test1 Last name: test2 Email address: [email protected] this need to be in CSV format
-
-
TJ Zimmerman over 3 yearsIf you have a lot of records returned you will need to first modify the limit or the results will be truncated.
ipa config-mod --searchrecordslimit=######
-
djdomi almost 3 yearsi suggest, you should explain what kind of script you plan to install, and why we should install it?
-
Luc Deschenaux almost 3 years@djdomi If you need answers about some script you consider to install, please be more specific, But first please read the description with "npm info" or on the related github page if the script name is not sufficient to picture it. As for why you should install it, obviously to achieve the expected result.
-
Jeter-work over 2 years@LucDeschenaux, they're referring to the github script (from a random project from an unknown account) suggested in the answer. There is no information about the script. Due dilligence would be to go to github and look at what the script does.
-
Jeter-work over 2 yearsI like that this uses IPA and perl without needing to add other items. I think I will use sed to convert, since I don't know perl.
-
Luc Deschenaux over 2 years@Jeter-work Good, do look at what the script does despite of anybody says. Or if it is not applicable, run it in a container or a VM without internet access instead, that's best practice.