How to change users.xml from being readonly?
Asked Answered
S

1

6

I've set up a working instance of a ClickHouse server with docker-compose. Right now I'm trying to grant privileges (write permission) to a user who is defined in users.xml as such:

<users>
        <deep>
            <access_management>1</access_management>
            <password>xxx</password>
            <networks incl="networks" replace="replace">
                <ip>::/1</ip>
                <ip>192.168.65.155</ip>
            </networks>
            <profile>default</profile>
            <quota>default</quota>
        </deep>
</users>

I'm using this command

GRANT INSERT ON registry.simple_people TO deep

which gives me this error message:

Code: 495, e.displayText() = DB::Exception: Cannot update user `deep` in users.xml because this storage is readonly: Couldn't update user `deep`. Successfully updated: none (version 20.12.3.3 (official build))

I've read the docs from ch here https://clickhouse.tech/docs/en/sql-reference/statements/grant/ and also I've been setting the readonly option to 2 and 0 without any difference in the output. Can anyone of you see where I could've missed something or what I ought to do to be able to make users.xml "not-readonly"?

Note:

The user 'deep' can read from the DB.

I'm on WSL: Ubuntu-20.04

Stich answered 17/12, 2020 at 11:52 Comment(0)
R
1

Most probably you are executing inserts using HTTP GET instead of POST.

https://clickhouse.tech/docs/en/interfaces/http/#http-interface

When using the GET method, ‘readonly’ is set. In other words, for queries that modify data, you can only use the POST method. You can send the query itself either in the POST body or in the URL parameter.



There are two ways to manage users.

The old XML-way and the new create/grant/RBAC.

XML created users cannot be granted. They are managed using XML settings.

By DEFAULT XML users have full access to EVERYTHING.

You can set READONLY using XML + profile and set this profile to the XML user.

    <profiles>
        <roprofile>
            <readonly>1</readonly>
Reincarnation answered 17/12, 2020 at 18:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.