kemenaran
(Pierre de La Morinerie)
October 20, 2021, 11:03am
1
Hello there,
I’m scripting the deployment of new Mattermost instances (https://github.com/YunoHost-Apps/mattermost_ynh/blob/master/scripts/install ), and I’m trying to create the first user of the server.
So I do
bin/mmctl user create --email $email --username=$admin --password '$password' --locale $language --system-admin
But it fails with:
Error: cannot read user credentials, maybe you need to use login first
The thing is, I can’t authenticate, as I didn’t create any user yet.
Is it possible to create the first user of the system using mmctl?
(And otherwise, is it wise to open an issue for this?)
agnivade
(Agniva De Sarker)
October 22, 2021, 6:36am
2
Hey @kemenaran
The first user that you sign up with in the system will always be a system admin. So you can use the UI and sign up as usual for that.
Alternatively, you can use mmctl in --local
mode (mmctl Command Line Tool — Mattermost documentation ) to perform operations without logging in.
kemenaran
(Pierre de La Morinerie)
October 30, 2021, 12:35pm
3
I seems the local mode is exactly what I need. I’ll try that right away. Thanks for the advice!
Hi! I’ve a question about local mm user creation. How can we authorize on MM with local created user? As usually?
For example:
I create user locally
email = “qwe@qwe”
name = “dan”
password = “password”
subprocess.run([“mmctl”, “–local”, “user”, “create”, “–email”, email, “–username”, name, “–password”, password,
“–firstname”, “firstName”, “–lastname”, “lastName”])
I wanna auth with this user on MM to add another users, teams and channels. Should I do like this?
url = “some-url”
community_name = “test”
username = “dan”
password = “password”
subprocess.run(
[“mmctl”, “auth”, “login”, url, “–name”, community_name, “–username”, username, “–password”, password])
agriesser
(Alexander Griesser)
November 8, 2022, 5:14am
5
Hi KoloskovaMariia and welcome to the Mattermost forums!
Yes, authentication is the same as with other users, depending on your server configuration. If you support multiple authentication types (LDAP, email, etc.) you would need to specify the authentication backend upon user creation. The code snipped you posted will create a user account with email/password authentication.
In order to add users to a Mattermost installation, the user needs to be at least get the team admin permissions so they can send invites or create invite links which others could then use to create their own unprivileged accounts.
User creation using mmctl
is only available for system admins AFAIK.
Thanks a lot! Now I know what to do in my work project!
agriesser
(Alexander Griesser)
November 9, 2022, 5:53am
7
Awesome, great to hear that If you have further questions, please don’t hesitate to create a new issue here in the forums.