Search code examples
linuxpermission-deniedtail

Tail command without permission in Linux


When I try to use 'tail' command in a cloud server, I'm get a permission denied error:

$ ssh myUser@server

:~$ tail /var/log/syslog
tail: cannot open ‘/var/log/syslog’ for reading: Permission denied

How to get permission in tail command?


Solution

  • The file you are trying to read has permissions that disallow reading by any users that aren't part of the admin group.

    Option 1: Run the tail command with the sudo command which escalates your access to root for the command that follows.

    example sudo tail /var/log/syslog

    Option 2: Add your user to the admin group so that you don't have to sudo each time you want to read the syslog file.