Auth not working, does not prompt for login

Hi. I'm brand new to node-red. I just installed node-red on my Ubuntu 18.04.3 LTS server (node.js version 8.16.1, node-red version 0.20.8). Following I edited /usr/lib/node_modules/node-red/settings.js with:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "XXXXXXXXX",
permissions: "*"

I then ran pm2 restart node-red
When I try to load the node-red page in my browser, it still doesn't ask for the password. I even tried in another browser.

What can I do to debug this problem?

restart node-red (or check your pm2 logs) and check the settings.js file location that
Node-RED is using (listed at startup)
My guess is you've edited the master rather than the copy which is usually in your .node-red directory

Thanks. Yes, that seemed to do it. I guess /usr/lib/node_modules/node-red/settings.js is the master you referred to, and /root/.node-red/settings.js was the right file.

As a long time Linux user, it certainly is confusing (bordering on worrying) to have files under /root configuring a service. Or to have ANY files under /root that would affect services. Did I do something wrong?

Possibility yes.

The documentation on this site for installation has a script for installing and I'm pretty sure it specifically says to not install using sudo or root.

I believe you will have issues going forwards too.

Or maybe you are stating node-red as sudo or root?

Basically don't.

1 Like

I'd start by checking the pm2 script you used.

I followed which says to use sudo. It seems weird to use the script for RPi on Ubuntu, but there you go.
Still uncomfortable with running services under user accounts, but that seems to be how this works

Raspbian is based on Debian as is Ubuntu so the script will run across all three. Yes you install it using sudo but run it as a user so it doesn’t have root privileges. You can set it up to run as a user that you don’t use for anything else to keep it cleanly separated.

I can't see anywhere on that page where it says to run (as opposed to install) using sudo.
If you could point as to the part of that page where it says to do so we can make sure it is corrected.


Hi all, I have edited both files : the master and the copy and it still doesn't work.
Anyone knows what might be the problem?
I'm using node-red on a linux based PLC from Phoenix Contact : axc f 2152 starter kit.
Any help would be greatlty appreciated.