Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Cannot open log file for writing: #1443

Closed
AlexanderPanshin opened this issue Mar 4, 2024 · 2 comments
Closed

ERROR: Cannot open log file for writing: #1443

AlexanderPanshin opened this issue Mar 4, 2024 · 2 comments

Comments

@AlexanderPanshin
Copy link

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:

@JeanPluzo
Copy link

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.

@AlexanderPanshin
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants