This maybe not a Node-Red question directly but maybe someone can think about how this can be done cleanly within Node-Red.
I want to read in a file from a network share. And I want to dynamically create a link (with something like an EXEC node) to other PCs CIFS shares to get these files.
I've got a solution working but it's kinda messy and I worry about long term maintenance and unintentionally breaking something else.
For my setup I have Node-Red running in a Docker container. I installed CIFS-UTILS inside the container and can map CIFS shares fine from the CLI.
For the EXEC node to work I had to:
- give the container SYS_ADMIN and DAC_READ_SEARCH priviliges
- give the node-red user a password
- add the node-red user to sudoers
My EXEC node command is:
echo <node-red password> | sudo -S mount -t cifs -o username=<CIFS username>,password=<CIFS password> //<IP>/<CIFS share> /usr/src/node-red/mount/<mount point>
This all sounds like a bad idea but so far everything works fine. And the mount only exists inside the container. The Docker host can't see it.
I tried using the SMB2 npm package but it just kept giving me errors I didn't feel like tracking down. It seems like that would have been a nice clean way to host the whole CIFS client inside a node so I wouldn't have to do anything with the host system.
My question is, Is there another way to get files from CIFS shares inside Node-Red? It would be a handy node to have.