serial port (USB) permissions

0 views
Skip to first unread message

Johan Helsingius

unread,
Aug 6, 2025, 10:33:32 AMAug 6
to FreeBSD questions
Hi,

Connecting a serial adapter to the USB port works otherwise
OK (shows up as /dev/ttyU0, but seems only root has access
to the port. I am used to some group like "dialout" having
access as well. Is there some setting for allowing ordinary
users access. or do I have to do a chmod every time I connect
the device?

Julf


Marco Moock

unread,
Aug 6, 2025, 11:03:37 AMAug 6
to ques...@freebsd.org
ls -la /dev/ttyU0

--
Gruß
Marco

Send unsolicited bulk mail to 1754490...@cartoonies.org

Johan Helsingius

unread,
Aug 6, 2025, 11:58:13 AMAug 6
to ques...@freebsd.org
On 06/08/2025 17:02, Marco Moock wrote:
> ls -la /dev/ttyU0

crw------- 1 root wheel 0x19f Aug 6 16:24 /dev/ttyU0

(before I did chmod a+rx to get things to work)

Julf




Arthur Chance

unread,
Aug 6, 2025, 12:00:03 PMAug 6
to Johan Helsingius, FreeBSD questions
Take a look at man devfs.rules (and maybe man devfs).

You want a local ruleset and a rule something like

add path /dev/ttyU* mode 0660 group dialer

You'll also need to set devfs_system_ruleset in /etc/rc.local to use the
new local ruleset.

--
We should have listened when the modems screamed at us.

Carl Johnson

unread,
Aug 6, 2025, 5:38:37 PMAug 6
to freebsd-...@freebsd.org
Look at 'man devfs.conf'. It has similar examples that show how to
automate that. I have the following in my /etc/devfs.conf:
own ttyU0 root:dialer
perm ttyU0 660
I also have my user ID in the dialer group in /etc/group.

--
Carl Johnson ca...@peak.org

Johan Helsingius

unread,
Aug 7, 2025, 1:51:05 AMAug 7
to ques...@freebsd.org
On 06/08/2025 23:38, Carl Johnson wrote:
> Look at 'man devfs.conf'. It has similar examples that show how to
> automate that. I have the following in my /etc/devfs.conf:
> own ttyU0 root:dialer
> perm ttyU0 660
> I also have my user ID in the dialer group in /etc/group.

Great! Thanks!

Julf




Arthur Chance

unread,
Aug 7, 2025, 2:42:38 AMAug 7
to Carl Johnson, freebsd-...@freebsd.org, Johan Helsingius
devfs.conf only works for devices that are already attached at boot
time. The OP specifically talked about plugging in a USB adapter which
could happen after boot, which is what devfs.rules is for.

Johan Helsingius

unread,
Aug 7, 2025, 2:58:13 AMAug 7
to ques...@freebsd.org
On 07/08/2025 08:41, Arthur Chance wrote:
> devfs.conf only works for devices that are already attached at boot
> time. The OP specifically talked about plugging in a USB adapter which
> could happen after boot, which is what devfs.rules is for.

Thanks for the clarification/explanation!

Julf


Tomek CEDRO

unread,
Aug 7, 2025, 11:19:14 AMAug 7
to Johan Helsingius, FreeBSD questions
***/etc/devfs.rules:
[localrules=10]
add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0660 group operator
add path 'usb' mode 0770 group operator

***/etc/rc.conf:
devfs_system_ruleset="localrules"

+ add your user to the operator group or change the group name above
to match your needs :-)

+ # service devfs restart

all shoud work now as expected :-)

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Johan Helsingius

unread,
Aug 11, 2025, 3:11:36 AMAug 11
to Tomek CEDRO, FreeBSD questions
Thanks!

Julf
Reply all
Reply to author
Forward
0 new messages