.env on ubuntu npm

Hello, I have installed successfully n8n using npm, and it’s running as it supposed to do using n8n start and n8n start --tunnel (for resting) however when I created .env file in the same folder as I execute n8n start the settings are not acquired. I have set up user and password, it’s not prompting for it therefore I assume the whole .env is not being read. any suggestions?

thank you in advance

Welcome to the community @marcondy!

Did you only set user and password? That would not work. You also have to tell n8n to use them by activating basic auth with N8N_BASIC_AUTH_ACTIVE=true.

If you create a file called .env and save it in the folder you start n8n from with the following content

N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=myUser
N8N_BASIC_AUTH_PASSWORD=myPassword

it should work fine. At least for me, it does.

Here the documentation for basic auth:

how could I have missed that part!

thank you!!! you are the boss

Happy to hear that it works. Have fun!