0

Based on the permission given below others can also read the file. I am logged in as ec2-user but I have to use sudo to read the file. Since permission is given for everyone to read why does it still ask sudo.

[ec2-user@ip-172-31-53-76 ~]$ sudo ls -la /var/log/nginx/access.log
-rw-rw-r-- 1 nginx root 22731 Sep  2 23:55 /var/log/nginx/access.log

permission of each of the folders

drwxr-xr-x  19 root root  269 Aug 26 00:52 var
drwxr-xr-x  9 root root 4096 Sep  3 03:19 log
drwxrwxr--  2 nginx root 159 Sep  3 03:19 nginx

What would I have to do so that I can run tail -n 10 /var/log/nginx/access.log without having to use sudo.

2
0

As Muru suggested, you only need chmod o+x /var/log/nginx and you should be able to tail the file using any user. If you want just a certain user to be able to access it, you can use ACLs.

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.