udev: Give a USB Device a Stable Name and Group
MediumKernel Security & Rootkits20-30 minA USB serial device lands on a different /dev/ttyUSB* and is root-only every time it's plugged in, breaking the app that expects it. Write a udev rule that pins it. Your assignment is in /root/case/assignment.env (VENDOR, PRODUCT, SYMLINK, GROUP).
Create a rule file in /etc/udev/rules.d/ (e.g. 99-SYMLINK.rules) with one rule that matches the device by its IDs and applies a stable symlink + group:
`
SUBSYSTEM=="tty", ATTRS{idVendor}=="VENDOR", ATTRS{idProduct}=="PRODUCT", SYMLINK+="SYMLINK", GROUP="GROUP", MODE="0660"
`
Match keys use ==; assignment keys use = (SYMLINK+= appends). Grading reads the rule files (it does not run udevadm). On a live host: udevadm control --reload then udevadm trigger. See /root/case/brief.txt.
- Read the per-session device IDs and desired name/group
- Match the device by idVendor and idProduct
- Create a stable SYMLINK under /dev
- Assign group ownership of the device node
Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.
