How to prevent access an expected file using the wildcard('*') in sudoers.
Issue
-
In sudoers, I want to allow access to multiple files by using the wildcard('*') in the command list.
testuser ALL = /bin/cat /var/log/messages* -
However, this rule allows to access an unexpected file in the second file while still having root privileges. Is it possible to prevent it?
### OK $ sudo cat /var/log/messages-20200522 ### NG $ sudo cat /var/log/messages /etc/shadow
Environment
- Red Hat Enterprise Linux
- sudo
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.