[OpenWrt-Devel] [PATCH] base-files/hotplug: add "dialout" user group and use it for ttyXYZ devices

Michael Heimpold mhei at heimpold.de
Fri Mar 29 18:54:10 EDT 2019


This add that "well-known" group to the system database and changes
hotplug default rules to assign /dev/tty[A-Za-z]+[0-9]+ nodes
to this new group.

Background is to allow more fine-granulated permissions, e.g.
for daemons like ser2net which make UART ports available via network
and thus should not run as root when avoidable.

Signed-off-by: Michael Heimpold <mhei at heimpold.de>
---
 package/base-files/files/etc/group      | 1 +
 package/system/procd/files/hotplug.json | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/package/base-files/files/etc/group b/package/base-files/files/etc/group
index e8e2adf4ac..723a3832e8 100644
--- a/package/base-files/files/etc/group
+++ b/package/base-files/files/etc/group
@@ -3,6 +3,7 @@ daemon:x:1:
 adm:x:4:
 tty:x:5:
 mail:x:8:
+dialout:x:20:
 audio:x:29:
 www-data:x:33:
 ftp:x:55:
diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/files/hotplug.json
index 1c949bbea3..4221e15fe9 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -20,6 +20,10 @@
 						[ "regex", "DEVNAME", "^snd" ],
 						[ "makedev", "/dev/%DEVNAME%", "0660", "audio" ]
 					],
+					[ "if",
+						[ "regex", "DEVNAME", "^tty[A-Za-z]+[0-9]+" ],
+						[ "makedev", "/dev/%DEVNAME%", "0660", "dialout" ]
+					],
 					[ "if",
 						[ "has", "DEVNAME" ],
 						[ "makedev", "/dev/%DEVNAME%", "0600" ]
-- 
2.17.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list