environment variables aren't available across users, when you su into another user the variables disappear, this works around that issue by creating the files as root and chowning them to the proper user