Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Delete users via command line #208

Open
jettrich opened this issue Dec 13, 2023 · 2 comments
Open

Add/Delete users via command line #208

jettrich opened this issue Dec 13, 2023 · 2 comments

Comments

@jettrich
Copy link

Dear Community,

I have a overleaf CE instance running, and I need to know how to add/delete users via command line, but unfortunately I haven't found any description yet. Please, could anyone point me in the right direction?

Kind Regards!

@jettrich
Copy link
Author

Ok, in the meantime I found that I can get a list of users by a query to mongodb container:

$ docker exec mongo sh -c 'exec mongoexport -d sharelatex -c users -f email --type=csv'
2023-12-14T08:53:24.188+0000    connected to: mongodb://localhost/
2023-12-14T08:53:24.202+0000    exported 2 records
email
xx1.yyy@zzz.com
xx2.yyy@zzz.com
xx3.yyy@zzz.com
xx4.yyy@zzz.com
xx5.yyy@zzz.com
$

Then I can use bin/mongo to connect to the container, an use db.users.remove(...) to delete a user

db.users.remove({email:"xxx1.yyy@zzz.com"})

QUESTION: Does the system take care of deleting also all files related to thast user?

Much the same way, I can connect to mongodb and use db.users.insert() to add a user

db.users.insert({email:"what.ever@zzz.com"})

And I can set the password with a generated bcrypt hash as

db.users.update({email:"what.ever@zzz.com"}, {$set:{hashedPassword:"$2y$12$_HERE_COMES_THE_SALT"}})

but I cannot login with the updated password. From a former post in overleaf repo I found that the user mentioned, that it worked using the correct hash. I've played around a bit, an I found that it worked using $2a at the beginning instead of $2y which is the default from htpasswd, since bcrypt version 2a is somehow old as far as I understood.

At the end I'm looking for a set of scripts, with which I'm able to create/delete users from my local Overleaf CE instance - I will keep on posting my findings here.

Cheers!

@jettrich
Copy link
Author

Please, could someone show me how to create users by using the mongoimport command, as well a how to update passwords using mongoimport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant