WIFI-Configuration

Hi,

I would like to know is there any possibilities to change Wifi configuration file on raspberry pi from Node-red.

That would require root access to the file system, so basically not recommended.

Thank you so much for your reply.

If i want to do,is that possible??..How will i do it??

Why do you want to do it at all?

I need it for my project...Have to do wifi configuration from nodered

Does your project explicitly has this request as a must-have? If so, I’d go back to the technical/functional designers, and/or the client, and/or the teacher. Doing it directly from node-red requires root access. Running node-red as root is a bad idea, for example if something goes wrong it can eff up your entire system. On top of that, if others get access to your node-red install they now have root access to your system, and with the exec node present it can be used for everything, whether that is participating in a botnet or mining cryptocoins.

I’d say go back to the drawing board and work out if there’s a different solution to this problem, or check if this type of solution is even needed in the first place and whether the problem can be solved in a different way.

For an unrelated example of why solutions tasked to be put in a project aren’t always a good idea and why going back to the person giving you this task is a good idea, one of my closest friends graduated university a few years ago. In her final year, the professor tasked them with creating a web application that stored XML files with data in a database, in BLOB format. This xml data had to be transferred to a web page, parsed, and used to put together some kind of display in JavaScript. Using JSON instead of XML would have been a much better solution here, but it wasn’t in the requirements and the professor did not allow other options.

Still, going back and explaining why you think it isn’t the best solution/what could be done better instead might be the best solution in other cases.

3 Likes

Is there any other solution, i can achieve this wifi configuration???

Google how to do it by editing system configuration files, once you know that you can do that from node red, but again it is a really bad idea to allow node red to edit system files.

Exactly as Colin said. Beyond that you can google enough bad practices/how tos to get it to work the way you ask for, but I’m not going to repeat that for the same reasons I mentioned before.

Please, do yourself and any future maintainer/systems engineering a favour and don’t solve it by running as root. Read the last part again carefully: “if this type of solution is even needed in the first place and whether the problem can be solved in a different way.

What problem are you trying to solve by changing the wifi configuration through node-red? So I’m not asking about the solution (editing through node-red), but why does the configuration file need changing at runtime?