1

I'm running a program (syslog-ng) that must read and write several files in a given path. It was failing at start, claiming that it is unable to open a file in that path.

Please, assume this directory structure:

/var/platform/program

The platform directory has the permission set to 0655 (not execute permission to the owner user). If I change that permissions to 0755, syslog-ng works fine.

On the other hand, I have written a small program in C that try to open and write into a file in the same directory, and it works without problem when running as root, but syslog-ng is failing...

What can be the problem in this case?

1 Answers1

3

syslog wants probably to chdir to the directory and needs therefore the execute bit set on the directory.

See Execute vs Read bit. How do directory permissions in Linux work? for more information.

jofel
  • 26,758
  • Thanks for your answer. But, if it only wants to read/write from inside /var/platform/program/something_more? It was failing when try to read the configuration file, that is stored on that way – JoseLSegura Sep 27 '13 at 10:11
  • 3
    You need the x bit as well to write files in the directory if you're not root. root can do anything in any directory regardless of the permissions. Most probably syslog-ng is not running as root or has dropped some priviledges. – Stéphane Chazelas Sep 27 '13 at 11:52
  • Theoretically it's running as root, as it's shown by ps ufax – JoseLSegura Sep 28 '13 at 10:19
  • This answer put my in the right direction: I saw that syslog-ng is dropping some root privileges and that there is an option (not documented in the help output) to avoid this privileges dropping. Now, it's working like a charm. Thank you! – JoseLSegura Oct 15 '13 at 15:46