coturn / coturn

coturn TURN server project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: Cannot open log file for writing:

AlexanderPanshin opened this issue · comments

Greetings. Tell me what could be the problem.
ERROR: Cannot open log file for writing:
In turnserver.conf

no-stdout-log
log-file=/home/log/turn.log

Set permissions on the folder
log in the home directory
drwxr-xr-x 2 turnserver 4096 Mar 4 10:43 log
created folders inside

-rwxrwxrwx 1 turnserver 5116 Mar 4 10:43 turn_2024-03-04.log
-rwxrwxrwx 1 turnserver 0 Mar 4 10:43 turn.log

I gave them permission 777 so that nothing would bother me at all.
But the error does not disappear turnserver[1191]: ERROR: Cannot open log file for writing: /home/log/turn_2024-03-04.log
Somehow I decided to check whether the turnserver user can write to the folder, so I entered the command
sudo -u turnserver touch turn.log everything went smoothly, the turn.log file was created as expected.
But something strange happened in the turn_2024-03-04.log file. Entries appeared. I don't know if this is related to the problem. Tell me how to do it so that there is no error ERROR: Cannot open log file for writing:

Hi,
you might want to check your directory inheritance.
It could be that the turnserver user can write to the /home/log/ directory, but said user might not be able to access the /home directory.
Also, "please" and "thank you" work way better than "tell me!".
Regards,
J.

Hi, you might want to check your directory inheritance. It could be that the turnserver user can write to the /home/log/ directory, but said user might not be able to access the /home directory. Also, "please" and "thank you" work way better than "tell me!". Regards, J.

For the purity of the experiment, I created a folder at the very root
mkdir turnlog
Granted rights to the turnserver user
chown turnserver:turnserver /turnlog/
Then I changed the entry in the configuration file in turnserver.conf to

no-stdout-log
log-file=/turnlog/turn.log

Then I restarted the service
sudo service coturn restart
Then I checked the status
sudo service coturn status
Thank you very much, you are right, the error is gone.
I think the problem can be solved either by adding the turnserver user to the group for the folders to which access is needed, or by writing a log closer to the root so that all parent folders have the necessary permissions.