Password recovery in self hosted instance

I have built an n8n instance through a docker image on digitalocean using their droplet feature. I install all of the necessary environment variables, created a public authentication key, tried setting up smtp (failed) to reset the password on my instance because I cannot access it unless it’s on my local computer where the droplet is being spun up. My instance tells me “wrong password, are you sure you aren’t using cap locks?” When in reality I know I put the correct password in when signing up. I am trying to reset the password using docker exec -it n8n-docker-caddy-n8n-1 n8n usermanagement: update —email —password but it gives me an exit 2 error code saying the $PATH is too broad to be executed. I am confused on how else to trouble shoot this.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @mechanizedgrowth,

There’s a CLI command for that:

n8n user-management:reset

See documentation here.

To run a CLI in a docker image you are going to need a command like:

docker exec -u node -it n8n-docker-caddy-n8n-1 n8n user-management:reset

Ask ChatGPT for the command sequence. Explain your docker setup and it will come up with everything very quickly! I’ve done it before =)

If my reply answers your question, please remember to mark it as a solution.

1 Like

I appreciate your input. Yeah I have tried this CLI command but I get an exit 2 error response. “$PATH is too broad.” It’s weird

Try one of these:

Access the Container’s Shell:

Instead of running the command directly via docker exec, try opening an interactive shell in the container:

docker exec -it n8n-docker-caddy-n8n-1 /bin/sh

Once inside, run the reset command. This can help isolate whether it’s a PATH issue or a command formatting problem.

Check the PATH Environment:

The error mentioning that the $PATH is too broad might mean the n8n executable isn’t found in the container’s PATH.

Within the shell, run:

which n8n

This will show if the executable is available and where it is. If it isn’t found, you may need to use the full path (for example, /usr/local/bin/n8n).

Returned :

Docker: ‘docker exec’ requires at least 2 arguments

Usage: docker exec [options] container command [arg…]

I have not worked with build arguments so I’m sorry if this is rudimentary. How can I define these options or arg in my execution?

Do you have access to ChatGPT?

You can paste your shell outputs and it will instruct you with the next commands to try. It is really good at that!

Correction. I am dumb. I forgot one space in the previous command: docker exec -it n8n-docker-caddy-n8n-1 /bin/sh

Lol.

1 Like

Yay! So is the issue solved?

1 Like

So I had to do a few extra steps after identifying the correct path.

These particular CLI commands were missing : usermanagement: update
User:update

I double checked my version with this command to ensure it was an up to date version of n8n:

docker exec -u node -it n8n-docker-caddy-n8n-1 /usr/local/bin/n8n -v

My version is 1.79.3

First I started a shell inside the container using :

docker exec -u node -it n8n-docker-caddy-n8n-1 sh

I needed to reset these credentials via the database with SQLITE (running on Alpine Linux)

Then inside the container, I entered the database with this command :

sqlite3 /home/node/.n8n/database.sqlite

Side note

if you are getting this error:

root@username:~# docker exec -u node - sh

~ $ sqlite3 /home/node/.n8n/database.sqlite

sh: sqlite3: not found

You need to install sqlite3 temporarily using:

(For Alpine Linux)

apk add sqlite

or

(For ubuntu or Debian)

apt update && apt install -y sqlite3

Then ran:

sqlite3 /home/node/.n8n/database.sqlite


Next Once you see ‘sqlite>’ check the users table running this command:

Select id, email FROM user;

Make sure you see your user email

After that (I assume n8n hashes passwords) I generated a hash inside the container using:

node -e “console.log(require(‘bcryptjs’).hashSync(‘CoOl_CaT1’, 10))”

Make sure you note down the generated hash

side note again

You may need to install bcryptjs temporarily before running the hash generator


Go back to your SQlite prompt inside the container and run this command

UPDATE user SET password=‘PASTE_HASH_HERE’ WHERE email=‘user@domain’;

Exit sqlite and restart n8n

.exit
docker restart n8n-docker-caddy-n8n-1

Finally I committed the container changes using

docker commit c4e5b242289c custom-n8n

This is how I’ll access it later:

docker run -d --name my-n8n-container -p 5678:5678 custom-n8n

Added some docker volumes to persist data

docker inspect c4e5b242289c | grep Mounts -A 10

Checked for other changes compared to the original image using

docker diff c4e5b242289c

If i want to revert it to the a clean version ChatGPT recommended me to run this:

docker stop c4e5b242289c
docker rm c4e5b242289c
docker run -d --name n8n-container -p 5678:5678 docker.n8n.io/n8nio/n8n

Hope this outlined my problem and thought process clearly. Happy building. Thank you for your input! It really helped as I have been facing this problem for days.

1 Like

Wooow that is a lot of inputs. Glad you could finally solve this.

Please mark this topic as solved so we can close it

1 Like

Definitely something messed up on the initial install.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.