How to create admin login and other login in influxdb

Hi ,

I have just installed Influxdb2 on linux … I have created login using UI .
but now i am trying to create admin login from command prompt ot is giving error …‘Unauthorized access.’

$ influx user create -n abcd-p xxxxx -o 000
Error: Unauthorized access.
See ‘influx user create -h’ for help

4 Likes

same here . any update or help here please.
in V1 I used to authenticate via CLI: influx -username ‘myuser’ -password 'xxx’
what is the process in V2 ?

solution: Create .influxdbv2/credentials and paste only the token that is created for your admin account / or has rights to create user (write). Works perfect

2 Likes

So, where do I find the admin token?

It is not working with the tokens I can create under Data -> Tokens.

1 Like

Same thing here.
Error: Write:users is unauthorized.
CLI interface or python/java client give the same error.
How to create new user account?

I stumbled over this as well, you need to add -t and a valid token from an admin user then it works.

Me as a interested user and not a super nerd must say v2 sucks balls, documentation is not intuitive and I’m going to give it a break for a while.
I’m using v1.8 with and without SSL, with and without users and passwords and all that without any issues plus it was quick to implement. So good examples in the documentation.

2 Likes
influx -t xxxx user create -n userName -p pass -o TS
3 Likes

Maybe this was obvious to others, but I struggled to find in the online documentation how to set the permissions of the newly created user. The influx auth create command ended up helping me achieve this. The help flag shows all the different permission flags and usage.

influx auth create -h

OMG This took me forever to work out.
I’ll post my steps to help out any others.

  1. Copy the long string of your token either out of the GUI, Data → tokens → click on User’s Token and copy the long string of chars. or
    influx auth list
    and copy the Token Value. This is called ${THEVALUEOFYOURTOKEN} below.

  2. Update the default configuration to automatically manage the token as below.
    influx config create -n default -t ${THEVALUEOFYOURTOKEN} -a

  3. Now Create your user
    influx user create -u USERNAME -p PaSswOrD -o org-name

  4. You may need then to create an all access token for your org and give that the user not the admin token.

hope that helps.

1 Like

@allthemoose trying out your approach but i am getting the following error for some reason

root@fd0b60813e89:/# influx user create -n legacyuser -p password -o myorg.cloud
Error: Invalid character '<' looking for beginning of value.
Error: Invalid character '<' looking for beginning of value.
See 'influx user create -h' for help

Thats Odd, i repeated my own instructions above and get;

.rror: <html>
.rror: <html>
See 'influx user create -h' for help

I did have to restart my server in the mean time so I guess something changed or my instructions above are wrong.

Will let you know when I work out how to get around it! :slight_smile:

1 Like

Hi Molnart,

I finally got it to work again using the config system.

I was doing the following things wrong that you could check.

  1. Didn’t use the root admin token in the config creation. Only the admin token has the ability to create users. Even an all access token and a read-write token cant do that.
  2. the -c flag can be added to the command to specify a config other than the active config to use for the command.
  3. org name in the config should match the org name the user is being added to.
  4. You can use the -t flag to create the user specifying the token directly instead of using the config.
  5. Was using the wrong command to set the active config. use the command below to change the active config to the config with your admin token before trying the user creation.

Influx config adminConfig

to get it working i created some users first using the token directly like @LazyLinuxLover showed us above and then created a new config with the admin token switched to that and the tried it. It seems very hit a miss for what is a bit of a simple task.

Let me know how you go.

i gave up temporarily on this and forgot about it for a while…

i don’t really get why should i create separate config for this, nor what different configs mean in terms of influxdb… i have a default config created linked to an organisation.

for some reason influx auth list does not work me:

root@fd0b60813e89:/# influx auth list
Error: Invalid character '<' looking for beginning of value.
Error: Invalid character '<' looking for beginning of value.
See 'influx auth list -h' for help

also trying to create a new auth using my admin token fails:

influx auth create -t {$TOKENVALUE}
Error: Failed to get ID for org 'myorg.com' (do you have org-level read permission?): invalid character '<' looking for beginning of value.
Error: Invalid character '<' looking for beginning of value.
1 Like

I created an account so I could love your comment, it does suck balls so much.

1 Like

So much hating Influx setup…
Installed and running, but no commands will be accepted at the CLI. For example:

root@server:~# influx org create -n openhab-org

Is met with the response

Error: failed to create org “openhab-org”: 401 Unauthorized: unauthorized access

I receive this response for any command and unable (or am unaware how) to in any way edit my configuration. Any and all help, please!

Try to add the admin token -t

influx -t {admintoken} user create --name blabla --password password123 --org acme
gives Error: flag provided but not defined: -t

various other attempts give me:
Error: failed to lookup org with name "acme": 400 Bad Request: unable to decode response content type ""

The org exists, but I’ve switched the server from http to self cert https, I already added these users previously without problem under http running. However it is receiving data correctly. More about my data dilemmas in another thread.

You need to put this parameter after user create instead of before it

1 Like

Cheers, didn’t expect anything to be positional…