Tom H grabbed a keyboard and wrote: > On Wed, Jan 9, 2013 at 3:33 AM, Steven Jan Springl > <steven@springl.ukfsn.org> wrote: >> On Wednesday 09 Jan 2013 04:08:30 David Guntner wrote: >>> >>> Does anyone know where the $MAIL environment variable get set when a >>> user logs in? It's not in the ~/.profile or ~/.bashrc files that get >>> put in when the account is created. I'm not sure where to look.... >> >> On my system $MAIL is set in /etc/pam.d/login and /etc/pam.d/su > > Since ~2005! I stand corrected! It was good to know about /etc/login.defs just the same, so thanks to both of you for that information. I've recently switched over my system to using Maildir format (with storage being under the users' home directories. Since there are mail programs like Mutt (among others) which looks at $MAIL by default to figured out where the mail is, I needed a way to set it properly. I suppose I could have created a /etc/profile.d extra file to just override, but I was unsure if that would cause problems elsewhere, or down the road. Figured it was best to get to the source if I could and change the setting there. Found the section in /etc/pam.d/login (and the corresponding one in /etc/pam.d/su) which reads: # Prints the status of the user's mailbox upon succesful login # (Replaces the `MAIL_CHECK_ENAB' option from login.defs). # # This also defines the MAIL environment variable # However, userdel also needs MAIL_DIR and MAIL_FILE variables # in /etc/login.defs to make sure that removing a user # also removes the user's mail spool file. # See comments in /etc/login.defs session optional pam_mail.so standard Read up on "man pam_mail" and found what needs to be changed there to point it to the right directory within a user's home directory and tested it. $MAIL now points where it should - w00t! :-) The comments in /etc/login.defs pointed me to /etc/default/useradd, and I found the variable there that controls whether or not useradd creates a /var/mail/$user entry - which it would seem that kuser ignores. :-) Oh well, a minor quibble. At least when I user useradd instead of the KDE tools for it, it will not create an empty (now unused) file there. So thanks to both of you for pointing me in the right direction, and thanks to everyone who replied! --Dave
Attachment:
signature.asc
Description: OpenPGP digital signature