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?

1

2 Answers 2

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`

1
  • This ought to be set automatically by the system when you login. Probably the solution is in the other answer posted today. Oct 8, 2018 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .