Service is not starting on user-owned folder in Linux (user rights mishandling, bug)
I was maintaining a customized tor core repo mainly for Russians on Github for Windows, gained some popularity (207 stars) and now trying to do the same for Linux, using the tor-expert-bundle-linux-x86_64-14.5.1.
It was pretty smooth up to some point when I tried to create a service using system-md. Unlike Windows, system-md is allowing a lot of playing here and there. My idea is the Tor PORTABLE, so I want it to run from the same folder... I wanted to do both the user-tor and the service-tor from the SAME folder.
But in Linux tor core is always checking not the RIGHTS of the user, but the "is the user is the owner of the folder?" condition. Using chmod -R 77 "$(dirname "$0")"
I want both root and the user of the folder having full rights accessing it. Yes, root-created files will be inaccessible for at least some time for a regular user, which can be bad in theory... but if I have separate service-delete and service-create conditions, I can just run chmod -R 77 "$(dirname "$0")"
, so there will be no inaccessible files in directory. Now tor as a service is refusing to work, even if it has all permissions, just because root is not the owner of main /data directory. It can read, delete and write files here, but it just thinks that it can't do it. With the exact bug:
Checking only for owning the folder is not a perfect behavior. It should check only for the ability of actually deleting, writing and reading files. I hope you can change it, because it definitely not a Linux problem. Root in Linux is actually indifferent to the owner of the files, it HAS all the rights it needs anyways, "ring 0" is definitely NOT the wrong user in this case. If you fix this, it will allow to run the tor-service from the same folder as tor-user. Thank you. Sorry for my English.