Get a list of all installed users?

NethServer Version: 7.6

I would like to know an elegant way to list all installed users (AD) and their mailaddress via CLI ?

The reason is to prepare importable config-files for k9-mail app for our android smartphones…

You can do that with samba-tool.
In order to make this work you first have to connect to the nsdc container (from the terminal of the NS server that has the NSDC installed):

systemd-run -M nsdc -t /bin/bash

Then list all users using samba-tool:

samba-tool user list

/edit: oops, this does not list their email addresses…

/edit2: I think your best bet would be using ldapsearch

1 Like

Great, thank you vy much. This helps a lot…

this script allow to retrieve the user even in the case of a remote LDAP account provider

/usr/libexec/nethserver/list-user

install jq to list them easily

/usr/libexec/nethserver/list-user|jq

this is a code example how to retrieve the key (email address) of each user

2 Likes

Vy nice, I will try it out tomorrow. Thank you !