I have a log file located at /var/log/snort/alerts. I want to grant one of my users access to read this file, however, I don't want to grant that user access to the directory /var/log/snort.

My solution was to create a group read_snort_alerts, add the user to the group, then make the file owned by that group. Then I was going to make a hard link somewhere that granted the user direct read access to the file.

But I'm still getting permission denied.

Here is the file permissions on the original file /var/log/snort/alerts. Anyone in the owning group has read access.

$ ls -l | grep alert
-rw-r----- 2 snort read_snort_alerts  6067 Oct 9 20:40 alert

Here is the hard link

$ ls -l | grep /tmp/hardlink
-rw-r----- 2 snort read_snort_alerts  6067 Oct 9 20:40 hardlink

The user is named john, and belongs to the correct group.

$ groups john
john : john sudo read_snort_alerts

Then as John I cannot read the file.

$ less /tmp/hardlink
hardlink: Permission denied

Here are the permissions on the directory of the folder that contains the original file.

$ ls -ld /var/log/snort
drwx-s--- 2 snort adm 4096 Oct 9 21:19 /var/log/snort

Any ideas?


I found the answer here.


I needed to log out and log back in again in order for the new group to take effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.