Trying to run
systemctl --user start my-service.service
on Ubuntu server 20.04 as a non-root user I get
Failed to connect to bus: Permission denied
Even just
systemctl --user
gives the same error.
The user was created with adduser --disabled-login my-user and is accessed by running su my-user.
Based on what I found researching this issue it seems that some environment variable is not properly initialised when doing su as opposed to "logging in" that causes this.
Show your work:
su? – steeldriver May 30 '23 at 20:39su --logininstead of justsumight've also done the trick. – Gecko Jun 07 '23 at 15:33