NodeRED FreeNAS-11.3-U2.1 USB Permissions

mvcutter

Cadet
Joined
May 22, 2020
Messages
2
Hi everyone,

I am trying to get an Arduino connected via USB to my NodeRed iocage. I admit I'm a noob when it comes to FreeBSD, any help is greatly appreciated.

Here are the things I have done so far.

1) Created a custom devfs_ruleset and assigned that to my jail, this executes on reboot of the NAS. This has allowed me to see the port within the iocage. I did the same for a Z-Wave controller and that is working fine (although that shows up as a slightly different name and is part of the dialer group)

Code:
#!/bin/sh

## Create custom devfs_ruleset RULE_NUM
RULE_NUM=99

/sbin/devfs rule -s ${RULE_NUM} add include 1
/sbin/devfs rule -s ${RULE_NUM} add include 2
/sbin/devfs rule -s ${RULE_NUM} add include 3
/sbin/devfs rule -s ${RULE_NUM} add path zfs unhide
/sbin/devfs rule -s ${RULE_NUM} add path 'bpf*' unhide
/sbin/devfs rule -s ${RULE_NUM} add path 'cua*' unhide
/sbin/devfs rule -s ${RULE_NUM} add path 'tty*' unhide


2) Modified permissions for the port (should be /dev/ttyU1 U0 a prior connection from this device when I swapped ports I believe)
3) Added the nodered user to the wheel group

Here is the output for my devices, this is within the iocage
Code:
root@NodeRed:~ # ls -l /dev/tt*
crw-------  1 root  wheel  0xf1 May 22 15:20 /dev/ttyU0
crw-------  1 root  wheel  0xf2 May 22 15:20 /dev/ttyU0.init
crw-------  1 root  wheel  0xf3 May 22 15:20 /dev/ttyU0.lock
crw----rw-  1 root  wheel  0xeb May 22 16:16 /dev/ttyU1
crw-------  1 root  wheel  0xec May 22 16:16 /dev/ttyU1.init
crw-------  1 root  wheel  0xf9 May 22 16:16 /dev/ttyU1.lock


Here is the output from running id nodered
Code:
uid1880(nodered) gid=1880(nodered) groups=1880(nodered), 0(wheel),66(uucp)


Finally here is the response in NodeRED

"serial port /dev/ttyU1 error: Error: Error: Permission denied, cannot open /dev/ttyU1"

I think this is some permissions issue I am missing... like I said I'm a bit of a nub when it comes to this... thanks in advance.
 

mvcutter

Cadet
Joined
May 22, 2020
Messages
2
I actually got it to work by running chmod a+rw /dev/ttyU*

While this works, it looks like its not ideal permission wise... Also when I disconnected/reconnected the port, it changed to ttyU2 needing new permissions... I'm sure there is a better way of granting the permissions I need in the back end to all tty* devices and I can handle the port changes on the NodeRed front end.... so I guess this is my updated question :) thanks!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
Based on what you show there, you need to run as root and not nodered (I don't know if you can really chmod on devices passed through to a jail from the host via devfs).
 
Top