Can again write or redirect from root in Catalina Mac OS

Viewed 364

I have a project which is maintained by multiple teams on various platforms (Windows, Linux, Mac). I have a Mac (Catalina OS) and the project and few of its dependencies write at the root of the system in some files and directories (/log/a/b/c/x.txt just an example there are many such files). Since the root location is no longer writable in Catalina, I am not able to run the project in my system. Project is in Java Spring, but I don't think any project related details are relevant here.

I somehow want again to be able to write at the root location. I don't know how but something I can think from the solution point of view

  1. If somehow in Java/Spring it can be set to append a prefix before every file path.
  2. In Java/Spring somehow if root can be redirected to some other location only from java.

I have gone through the solutions here but my company will not permit csrutil one on every system start.

Any help is appreciated.

2 Answers

Maybe chroot jail can help you. :)
Using it you can "jail" your application inside some directory (eg. /my-chosen-jail/). It would then consider that as a root. So if your application tries to create /test.txt it would in reality create /my-chosen-jail/test.txt.

If you wanted to solve this problem in 2 minutes, easiest would be to create a docker image with tomcat, and run your app like that. In the container it will be able to write wherever it wants to, and you can still open ports for debugging etc. Downside is I don't think live code edits work with this approach, although you could use Spring Dev Tools, mount the docker directory, etc. but it's a bit nasty. These issues are so annoying, and these settings obviously should have been in properties which could be overridden by environment variables so you wouldn't be facing these issues.

Docker is the ultimate solution of getting around exactly theses issues of works on my machine not on yours, hopefully that helps.

Related