sudo / sudoers on macOS: regex not working but wildcards/globs are
3
votes
1
answer
417
views
**System:** macOS 14.6.1, M2 MacBook Air
I'm trying to use a regex pattern match in my
suoders
file. According to the man sudoers
manpage as well as the online docs , that should be supported with sudo
v1.9.10 or higher.
Running sudo --version
on my system yields 1.9.13p2
so, should be ok there. Also, running the syntax check command below indicates that the file is being parsed successfully:
$ sudo visudo -c
/etc/sudoers: parsed OK
Here's an example line from my sudoers file which ***DOESN'T*** work:
luke ALL=(ALL) NOPASSWD: /bin/launchctl asuser ^[0-9]+$ /usr/sbin/screencapture -D1 -p
And here's are two similar commands using regular wildcards/globs that **DO** work:
luke ALL=(ALL) NOPASSWD: /bin/launchctl asuser ??? /usr/sbin/screencapture -D1 -p
luke ALL=(ALL) NOPASSWD: /bin/launchctl asuser * /usr/sbin/screencapture -D1 -p
I've done as much debugging as I can but remain flummoxed. Anyone got thoughts?
Asked by luckman212
(3945 rep)
Aug 27, 2024, 05:59 PM
Last activity: Dec 28, 2024, 03:16 AM
Last activity: Dec 28, 2024, 03:16 AM