Add user without sending an email invitation

Hello N8N team,

I think it’s a bit difficult to setup SMTP just to add users.
How about having a simple way to add users without sending invitation.

Thanks

If you’re comfortable working with the DB, you can just insert users into the users table. You should only need the firstname, lastname, email and a randomly generated UUID.

To generate a uuid you can use uuidgen, or an online service:

$ uuidgen
E0ADC782-0260-4207-AADD-513413E45C94

If you want to set the password for them you just need to generate a bcrypt hash which you can do with htpasswd or an online service:

$ htpasswd -bnBC 10 "" 'myLongSecurePassword' | tr -d ':\n'
$2y$10$14JMVmvcLtvbvmpPnmgBTuzp/GhMnG.VFQC.dNq4yMVjeXyQEL6lK

Taking postgres as an example a query to insert a new “member” user without password (they can create one with the forgot password functionality):

INSERT INTO public."user"
(id, email, "firstName", "lastName", "globalRoleId")
VALUES('E0ADC782-0260-4207-AADD-513413E45C94', '[email protected]', 'my', 'user', 2);

To insert the user with your predefined password:

INSERT INTO public."user"
(id, email, "firstName", "lastName", "globalRoleId", "password")
VALUES('E0ADC782-0260-4207-AADD-513413E45C94', '[email protected]', 'my', 'user', 2, '$2y$10$14JMVmvcLtvbvmpPnmgBTuzp/GhMnG.VFQC.dNq4yMVjeXyQEL6lK');
4 Likes

This is definitely useful
I will give it a try

Thanks

Hi,

Could you explain to me how I access my n8n’s database, please?

What’s your current setup? Desktop, docker, npm, Windows, Linux?

I’ll assume you’re using SQLite, so you would need to find the db file most likely in ~/.n8n

1 Like

Hi,

I am using Docker.

OK I’ll assume you’re mounting a volume like in the documentation -v ~/.n8n:/home/node/.n8n

In that case you can edit your database by opening up database.sqlite in the directory with a SQLite tool. Either on the command line with sqlite3 or a free GUI tool like DBeaver.

I’d recommend stopping n8n before editing the DB file.

2 Likes