Page 1 of 1

Can nodejs modify raspberry pi files

Posted: Tue Jun 26, 2018 12:39 pm
by wanstreet
I am thinking of running an Access Point webserver using nodejs,
the admin who will connect to the AP can login and change the AP ssid and password
To do this I need to make the changes in the hostapd.conf file, which is a system file.
So can I do this entire thing in nodejs?
Sorry if the question sounds silly, but I kinda need to know

Re: Can nodejs modify raspberry pi files

Posted: Tue Jun 26, 2018 1:15 pm
by topguy
You have two approaches for this.
- Either give the node.js process higher access rights ( run as root/super user )
- Reduce the security of the hostapd.conf file.

I would definitely prefer the last option. It depends on that "hostapd" is not very fuzzy about the security of its config file.

Re: Can nodejs modify raspberry pi files

Posted: Tue Jun 26, 2018 2:32 pm
by wanstreet
so it can be done on nodejs.
not just hostapd.conf
but i think if i further proceed with the webserver task, then there might be a point where i have to change the wpa_supplicant file too.

Re: Can nodejs modify raspberry pi files

Posted: Tue Jun 26, 2018 2:33 pm
by wanstreet
if these changes can be done using nodejs, then thanks for the info. :D

Re: Can nodejs modify raspberry pi files

Posted: Tue Jun 26, 2018 2:38 pm
by The Traveler
node.js is a javascript runtime. Reading, writing, modifying system files depends on how your javascript is coded and permissions are configured.

If node.js javascripts are running "sandboxed" for security then you would not be able to change the files you want.

Cheers.

Re: Can nodejs modify raspberry pi files

Posted: Tue Jul 03, 2018 10:21 am
by wanstreet
Ok, understood.
thanks a lot guys