[Pkg-shadow-devel] Bug#814670: login: su - clears XDG_RUNTIME_DIR

Rafael Cunha de Almeida rafael at kontesti.me
Sat Feb 13 20:47:51 UTC 2016


Package: login
Version: 1:4.2-3+deb8u1
Severity: normal

Dear Maintainer,

I have an user which has daemons enabled using systemd --user. If I
login with ssh, then all works well. However, if I try using

    su - contos

to login as the user. Then systemctl fails, like so:

    $ systemctl status --user contos
    Failed to get D-Bus connection: Connection refused

Upon further investigation I found out that systemctl expects the
variable XDG_RUNTIME_DIR to be set. In this particular case, we need it
set to /run/user/1029.

    $ XDG_RUNTIME_DIR=/run/user/1029 systemctl status --user contos
    ● contos.service - blog canto de contos
    (.. normal output ..)

If I use su contos (no -), then XDG_RUNTIME_DIR is kept the same as the
previous user (which is also no good).

Since this is set correctly when using ssh but not su, I'm supposing
this is a su bug. However, I admit I do not have a full understanding on
what's going on when you su or ssh to an user.

I also tried to use

    sudo login contos

with the same effect. So, as far as I know, using ssh to login with the
user is the only reliable way to work with user's systemctl.

Please, if it is impossible to fix this behavior in jessie, would you at
least give me a reasonable workaround on how to login as a different
user without the need of ssh?

Cheers,
Rafael

-- System Information:
Debian Release: 8.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.0-x86_64-linode63 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages login depends on:
ii  libaudit1       1:2.4-1+b1
ii  libc6           2.19-18+deb8u2
ii  libpam-modules  1.1.8-3.1+deb8u1
ii  libpam-runtime  1.1.8-3.1+deb8u1
ii  libpam0g        1.1.8-3.1+deb8u1

login recommends no packages.

login suggests no packages.

-- no debconf information



More information about the Pkg-shadow-devel mailing list