Actually, you should ask how to solve your primary problem. See https://specifications.freedesktop.org/basedir-spec/latest/#basics There is a single base directory relative to which user-specific runtime files and other file objects should be placed. This directory is defined by the environment variable $XDG_RUNTIME_DIR. So your application probably needs to run a (desktop or maybe UID specific) daemon and place runtime files somewhere. "su --login" nor "sudo" will not do it for you. But if you can create a directory and set the variable, your application should start to work.