In normal Ubuntu I used to create a dir for Unix sockets as follows (say for project
- Create a systemd script in:
- Place the following code in the script:
/run/foo 0770 <username> <groupname>
Then on the next reboot the dir
/run/foo will be created with the required permissions. The reason I do this is because only root can write to
/var/run which links to ->
/run, and its common for many apps to drop priviledges and change user before creating the socket, and hence they fail to write to
Now I am using WSL2, with Ubuntu 20.04, and
systemd does not exist. One can jump through many hoops to get it to work but they are buggy.
How does one create a folder with desired permissions which gets cleared after a reboot before any of the installed apps (e.g. nginx/postgresql) attempt to create their sockets (and hence fail due to stale sockets from before the reboot)?