Obtain list of users & groups from NS7 to recreate in NS8 (different domain)

NethServer Version: 7.9.2009
Module: Samba/AD

My current NS7 (AD/samba) is named “avion.lan”; I want to obtain a list of the users and groups to recreate sin a new NS8 “avion.org.mx”.

I tried using some “AI” but they all fail suggesting tools that are tied to a samba installation not for a NethServer 7/8.

I need help to get the list of users and groups:
I have saved the passwords; in this new domain my users will not have mail in “avion.org.mx” (some have their mail in another domain).

And of course, it would be great to be able to add the users and groups to the new NS8 server using a command tool that read a text file and recreate all (I got a script but not tested yet, for later); if it is not possible I will do it manually as I did at the time with NS7 (only now I have many more users).

Thanks in advance.

On NS7 users can be exported to a file using

/etc/e-smith/events/nethserver-sssd-remove-provider/S20nethserver-sssd-export-accounts

In /var/lib/nethserver/backup you’ll find users.tsv and groups.tsv.

See also nethserver-sssd — NethServer 7 documentation

There’s already a Feature request about importing users/groups to NS8: Users csv or similar import - #2 by mrmarkuz

2 Likes

Thank you @mrmarkuz

With this tip I found the data; and reviewing the group file I see that it lists each group and the users that are in the group (+1).

Just to confirm:

To date there is no trick or script to add the users and add to the group its users from a terminal?

You could use api-cli, see also GitHub - NethServer/ns8-samba: NS8 Samba configuration

Another approach would be running samba-tool directly:

runagent -m samba1 podman exec samba-dc samba-tool user
runagent -m samba1 podman exec samba-dc samba-tool group
1 Like