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
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
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.
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.
OMG This took me forever to work out.
I’ll post my steps to help out any others.
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.
Update the default configuration to automatically manage the token as below. influx config create -n default -t ${THEVALUEOFYOURTOKEN} -a
Now Create your user influx user create -u USERNAME -p PaSswOrD -o org-name
You may need then to create an all access token for your org and give that the user not the admin token.
@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
I finally got it to work again using the config system.
I was doing the following things wrong that you could check.
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.
the -c flag can be added to the command to specify a config other than the active config to use for the command.
org name in the config should match the org name the user is being added to.
You can use the -t flag to create the user specifying the token directly instead of using the config.
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.
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.
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.