ankicommunity / anki-sync-server-rs

A personal custom Anki sync server,aim to provide an easier way for deployment
GNU Affero General Public License v3.0
180 stars 27 forks source link

Authentication failed for nonexistent user #42

Closed AIndoria closed 2 years ago

AIndoria commented 2 years ago

Using the latest docker image for ARM64. Using latest AnkiDroid as a client.

This is what I get when creating a user after docker exec-ing into the container as either

ankisyncd user -a testuser testpwd

or going to /usr/local/bin and then doing ./ankisyncd user -a testuser testpwd

image

What I expected:

...for it to actually log in.


Edit:

unsure if this happens because of the mismatch in default config location or not. (see rootdir)

image

However, when I try to change the config location, it throws another exception:

image


Edit2: I can confirm that after copy-pasting, logging in works as expected.

cp -r /usr/local/bin/* /app

Please either make documentation clearer, or fix the location bug.

dobefore commented 2 years ago

Thanks for the report. That how to add user in container has been documented. in https://github.com/ankicommunity/anki-sync-server-rs/pull/41/files#diff-1d6b40a4d7c23ed086bafff99805b963b6e057b073e432b7d4d89954ae64a756

docker exec -it ankisyncd /bin/bash
ankisyncd user -a username password
exit

note:remove created containers before new journey.

AIndoria commented 2 years ago

that's the issue however, ankisyncd user -a username password, doesn't always work since by default, the root_dir is set as . whereas it should be /app

and passing custom location to ankisyncdvia the -c flag results in error given above.

Unless I'm missing something obvious.

dobefore commented 2 years ago

I think I found the reason. WORKDIR is not set,so user will not in /app when being logged into the shell of the container.

there is a quick fix.After logging into the shell,you will be in /,so you should enter /app by running cd /app.

And then you can perform actions on adding user