0

So I'm trying to run Supervisor (http://supervisord.org/) as a non-root user. However the process outputs logs to the /var/log directory which is owned by root and has 755 permissions. Therefore starting the process as a non-root user throws a permission denied error. What is a best practice for solving this issue? One idea I have is to recursively change the group of the /var directory to that of the user which is starting the supervisor process, and giving the /var directory 775 permissions. Is this acceptable from a security standpoint?

Justin Meltzer
  • 711
  • 1
  • 9
  • 19

3 Answers3

4

Try creating the log files and using chown to change the ownership to the appropriate user. If possible change the log location to a subdirectory owned by the appropriate user.

I use logrotate to rotate logs periodically. It can handle permissions when rotating logs.

BillThor
  • 27,737
  • 3
  • 37
  • 69
2

Use the user= directive in supervisord.conf, so that supervisord starts as root, does any necessary opening of files, and then drops privileges.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
0

If you haven't already, you could create a user specifically to run supervisord, and use an ACL to give that user write privileges in /var/log.

setfacl -m u:$USER:rwx /var/log

You can also do things like make your supervisord user a member of sys. (I think, I don't have a linux box nearby to verify that the /var/log group has write privileges.)

dafydd
  • 395
  • 2
  • 3
  • 10