It is necessary to allow reading logs /var/log/.* by a regular user. I do according to the documentation. This manual

mkdir -p /etc/sudoers.d/
visudo -f /etc/sudoers.d/mikelogger

inside visudo

mikelogger localhost.localdomain = /usr/bin/tail /var/log/messages


su mikelogger -
tail -f /var/log/messages

tail: cannot open '/var/log/messages' for reading: Permission denied
tail: no files remaining

1 Answer 1


Adding things to a file in sudoers.d as you did gives that user the ability to run the command specified using sudo.

Try this:

su mikelogger -
sudo tail -f /var/log/messages

You will be prompted for the mikelogger user's password and upon successfully authenticating using the password the tail command should execute properly.

  • 1
    Thanks! I have a suspicion that the documentation is not written correctly, because an error occurs you are not in the group sudoers, but with this configuration it works mikelogger ALL=(root) NOPASSWD: /usr/bin/tail -f /var/log/messages May 25, 2022 at 20:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .