-2

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?

eroberto88
  • 11
  • 1
  • 2
  • 1
    It's not your tail command that lacks access, it's you: `myuser`. If you have sudo access you can do `sudo tail /var/log/syslog` and give it your password. Otherwise you'll have to ask someone with access to grant you READ access to that file. – JNevill Aug 29 '18 at 14:11
  • 2
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Aug 29 '18 at 14:11
  • 1
    Off-topic here since not a programming question. You need to read a book on Linux. You might want to learn how to [use `sudo`](https://www.linux.com/learn/linux-101-introduction-sudo). And you probably should ask the sysadmin of that cloud server – Basile Starynkevitch Aug 29 '18 at 14:11
  • Just use sudo `sudo tail /var/log/syslog`. Next time ask this kind of question on Super User on Unix&LinuxExchange – megas Aug 29 '18 at 14:13

1 Answers1

4

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.

vicente louvet III
  • 384
  • 1
  • 2
  • 10