You are not logged in.
I want systemd user sessions to be instantiated automatically on SSH login. It looks like this should just work out of the box, since `pam_systemd` is configured to optionally run by the default `/etc/pam.d/system-login` provided by `pambase`:
server % cat /etc/pam.d/system-login
#%PAM-1.0
auth required pam_tally.so onerr=succeed file=/var/log/faillog
auth required pam_shells.so
auth requisite pam_nologin.so
auth include system-auth
account required pam_access.so
account required pam_nologin.so
account include system-auth
password include system-auth
session optional pam_loginuid.so
session optional pam_keyinit.so force revoke
session include system-auth
session optional pam_motd.so motd=/etc/motd
session optional pam_mail.so dir=/var/spool/mail standard quiet
-session optional pam_systemd.so
session required pam_env.so
This, however, doesn't appear to do much:
laptop % ssh server
server % systemctl --user status
Failed to connect to bus: No such file or directory
server % loginctl list-sessions
SESSION UID USER SEAT TTY
0 sessions listed.
Looking at the journal for `systemd-logind` shows that it's not even being asked to create login sessions for non-root users:
server % sudo systemctl status systemd-logind
● systemd-logind.service - Login Service
Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static; vendor preset: disabled)
Active: active (running) since Tue 2017-12-05 02:37:47 CET; 19h ago
Docs: man:systemd-logind.service(8)
man:logind.conf(5)
https://www.freedesktop.org/wiki/Software/systemd/logind
https://www.freedesktop.org/wiki/Software/systemd/multiseat
Main PID: 290 (systemd-logind)
Status: "Processing requests..."
Tasks: 1 (limit: 4915)
CGroup: /system.slice/systemd-logind.service
└─290 /usr/lib/systemd/systemd-logind
Dec 05 02:37:47 tangsanjiao systemd[1]: Starting Login Service...
Dec 05 02:37:47 tangsanjiao systemd[1]: Started Login Service.
Dec 05 02:37:47 tangsanjiao systemd-logind[290]: New seat seat0.
Dec 05 02:37:47 tangsanjiao systemd-logind[290]: Watching system buttons on /dev/input/event3 (Power Button)
Dec 05 02:37:47 tangsanjiao systemd-logind[290]: Watching system buttons on /dev/input/event1 (Power Button)
Dec 05 02:37:47 tangsanjiao systemd-logind[290]: Watching system buttons on /dev/input/event2 (Sleep Button)
Dec 05 02:38:20 tangsanjiao systemd-logind[290]: New session c1 of user root.
Dec 05 02:38:56 tangsanjiao systemd-logind[290]: Removed session c1.
Dec 05 02:39:04 tangsanjiao systemd-logind[290]: New session c2 of user root.
Dec 05 02:39:05 tangsanjiao systemd-logind[290]: Removed session c2.
Any idea what's wrong here?
Last edited by cdown (2017-12-05 21:00:32)
Offline
Ah, I assumed sshd defaulted to using PAM, but to my surprise by default UsePAM is `no` in upstream sshd. That was easy to fix :-)
Last edited by cdown (2017-12-05 21:00:20)
Offline