create cache and config dirs and in a safe, secure way