Upstart PID files in home directory?

Solution 1:

These files are there because several components in your system conform to the XDG Base Directory Specification and expect the environment variable XDG_RUNTIME_DIR to be set. If not set, the user's home directory is used.

pam-systemd is the component that sets XDG_RUNTIME_DIR to /run/user/$UID, where $UID is the effective user id for the user. In your case, pam-systemd has not run or has otherwise misbehaved, that is hard to tell. But you can easily set the XDG_RUNTIME_DIR at boot time yourself, as follows: sudo nano /etc/profile and add the following lines:

XDG_RUNTIME_DIR=/run/user/$UID
export XDG_RUNTIME_DIR

From the next reboot on, the .PID files will no longer clutter your home directory.