rszyma / kanata-tray

Tray Icon for Kanata
GNU General Public License v3.0
52 stars 1 forks source link

Permission error when viewing logs on macOS #27

Open jussapaavo opened 1 month ago

jussapaavo commented 1 month ago

When trying to read the logs, I get Unable to read the file. The log files are in the correct location and can be seen with Finder, but they cannot be opened with any application. After inspecting, it seems like the log files are created without read permissions for the current user. To fix this locally, I need to run chown myusername /private/tmp/kanata_lastrun_3545806179.log for each of the log files.

Is this because I run the kanata-tray service as sudo? I'm trying to research if I can fix this locally, but also wanted to report this if this is something that can be fixed in the source code instead.

Here's what ls gives:

.rw------- root wheel 19 KB 2024-07-27 11:32:45 AM /private/tmp/kanata_lastrun_1569220938.log
rszyma commented 1 month ago

Is this because I run the kanata-tray service as sudo

Yes. It's also a bit unfortunate that kanata need to run as superuser in macos, and there's no way around it. It's one of "security features" of macos. Log files being readable only by superuser make sense in that security framework, because if you (accidentally) enable --debug flag in kanata, you're basically keylogging yourself, but it's at least only readable to superuser.