Export users and groups to tsv-file

v69

(Ralf Jeckel) #1

NethServer Version: NS 6.9 final
Module: users / groups

Is there a script to export the users and groups of a NS6 to a tsv-file?
I found this script for NS7, but I was wondering if it exists also for NS6?

TIA for your help.


(Giacomo Sanchietti) #2

I don’t there is such a script ready to use, but it’s really easy to write it down.

What fields do you need?
To start, you could cycle on the accounts DB and print everything.

If you want to extract users from LDAP is a little bit harder but still can be quickly done.

Just let us know the specifications and we will write something :wink:


(Ralf Jeckel) #3

Hi Giacomo,

1st thanks for reply
2nd sorry for beeing absent. Loooong weekend with family in Paris.

What I want to to is, to save all userinformation and their preferences to a tsv file, then remove account provider to change the domain and FQDN with reinstalling an accountprovider. After that I would like to restore my users.
But now I found that this should be done with the nethserver-sssd-remove-provider signal. I’ll test if this is the right thing for me.

Thanks again and so long…

EDIT: Sorry I got that wrong. This signal is for NS7. My fault. I messed up versions and machines.
But after 5 days with 3 girls in Paris…

So again from the beginning:
What I want to to is, to save all userinformation with their preferences and the firewall objects and rules from a NS6 to a tsv file, so I can reimport them into a new and clean NS7. Without a complete backuprestore, just the users and the firewall objects. Is this possible at all for the firewall objects?
Why do I want this? With backup and restore or rsync you copy a lot of old unused stuff, but I want to clear everything up and to have a clean and new installation. I know tthat this is a lot more work, but that o.k. for me.

TIA. Ralf


(Giacomo Sanchietti) #4

Upgrading from 6 to 7 is not only a matter of re-importing existing esmith database, a lot of stuff is done for migrating the configuration format.
For example, users aren’t saved inside the accounts db in NS 7.

Please, go with backup and restore, otherwise you will face many many many headaches.


(Ralf Jeckel) #5

I did it with rsync and had a lot of problems with user rights on folders.
The owner and the group wasn’t transferd to the new machine.
The homefolders of the users had as owner “500” and as group "502"
The ibays the same.If I tried to fix it with GUI only the 1st folder was fixed.
I had to manually chown -R administrator@domain.tld:domain-users@domain.tld /path/to/folder and set the correct rights with cmod -R xxx /path/to/folder .
Do you have an idea why this happend?
source machine was a NS6.9 final with workgroup setup, targed machine was a NS7.4final.
I did as in the manual discribed.


(Giacomo Sanchietti) #6

Not without reading the logs :wink:

Since the upgrade it’s a complex procedure, you won’t get any benefits by doing it manually if you don’t deeply understand all the involved code.

To wrap it up, I can write a script for you which exports all users from accounts db to tsv format, but then you will be on your own for the upgrade procedure :slight_smile:


(Ralf Jeckel) #7

o.k. you convinced me.
I’ll start from scratch again.
Thanks for your help and your willing to write a scipt especially for me. :slight_smile: