Assuming that you are working on a Linux platform or similar, as Colin says, the system configuration files require root
user privileges in order to make changes.
While you could run Node-RED under the root
user, we tend to strongly discourage that since it means that if anyone got access to Node-RED or you created a flow that was a bit overly enthusiastic shall we say, your whole system could be toast.
In addition, changing config files generally then requires the service that reads them to be reloaded. In this case, I think that you would have to restart the device's network stack though I'm not an expert in that area so I might be wrong.
Putting aside the access requirements for a second, the correct way to change the IP address from the command line on a running Linux system is:
sudo ifconfig eth0 192.168.1.1 netmask 255.255.255.0
So you don't need to edit a file and the command is, I think, dynamic so no restart required.
You will note though that root
access is still required (the sudo
prefix runs the command in the context of the root user).
Now, it is possible to set a user to be allowed to run specific commands under sudo without requiring a manually entered password that would normally be needed.
You cannot run a command from Node-RED that requires a password to be entered at the command line but you could allow the user to run the command without a password and that would let you call the command using the exec node and driven by your Dashboard.
https://wiki.debian.org/sudo
Make sure that you restrict permission to the tightest possible command line spec though so that you aren't opening up unexpected security problems.