Fixing the path permission error for sqlite

SQLite needs write permission to the parent folder of the db file. So since we have the privileges dropped, SQLite logging was broken. Solution right now is a bit hackish. As soon as we have the user in the config file, we should have one central place to handle permissions.