1

I'm trying to setup a unit to run on Debian Stretch under a regular user. I connect to it over ssh.

I first did this as root (username being the user in question):

# loginctl enable-linger username

And then when I run:

# systemctl --user

I get:

Failed to connect to bus: Permission denied

How do I fix this?

galoget
  • 235
  • 1
  • 9

2 Answers2

2

There is another possible solution to this problem on Debian Stretch (at least): if the libpam-systemd package is not installed, then PAM never triggers systemd to create a systemd-user daemon.

0

It turns out that my in my installation of debian stretch the environment variable XDG_RUNTIME_DIR was badly configured for all non root users and was set to /run/user/0.

Instead it should be set to the id of the current user. To achieve that you can add the following to your .bashrc:

export XDG_RUNTIME_DIR=/run/user/`id -r -u`