Dear Maintainer,
After upgrading from Buster to Bullseye, I've noticed that $MAIL
variable is not set when one logs in via ssh, but is set when one logs
in on TTY. I don't think it was an intended behaviour.
I've looked through the possible places where it could be set and found
out that it was previously set in /etc/login.defs, but now is governed
by PAM.
Further investigation showed that PAM configuration for sshd which resides
in /etc/pam.d/sshd has the line
session optional pam_mail.so standard noenv # [1]
I've changed it to
session optional pam_mail.so standard # [1]
and now the $MAIL is set again.
Searching for the reason to set `noenv' there led me to this bug in BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=58429
In this bug it was reported that there were multiple non-informative
entries in auth.log if `noenv` was not enabled, but the bug was filed
more than 20 years ago, so I've checked if it is still the case.
Apparently it is not, the only new lines in auth.log are
Sep 1 19:42:14 laptop sshd[28790]: Accepted publickey for sqrt from 127.0.0.1 port 50194 ssh2: RSA SHA256:oCn47IKkSvC9WS1aUl52hD0UYsVtDT80s9pFDETWac0
Sep 1 19:42:14 laptop sshd[28790]: pam_unix(sshd:session): session opened for user sqrt(uid=1000) by (uid=0)
So I suggest we revert this `noenv' option as the reason for its
existing is gone and it causes problems like the one I'm filing this bug
about.
Thanks in advance!