[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Where does $MAIL get set?



David Guntner grabbed a keyboard and wrote:
> David Guntner grabbed a keyboard and wrote:
>> Following up to myself here, hoping that someone can help with one final
>> problem I've run into.....
> 
> [...]
>> If I ssh in from another machine. :-(  I've verified that I get the
>> value of $MAIL set to what I've put into pam.d files when I login via
>> the display manager for the GUI interface, and if I login to a console
>> terminal (alt-F1, etc.) it is set find there, too.
>>
>> However, when I ssh into my account from another machine, the value of
>> $MAIL has been set to /var/mail/$USER again!  Argh!
>>
>> I've checked my sshd_config file, and it has "UsePAM Yes" set in it.  So
>> does anyone have any ideas why a ssh session is ignoring the settings
>> I've specified and is still using the old default value for $MAIL?
> 
> Upon further looking, I've discovered /etc/pam.d/sshd, which was a
> sort-of "duh" moment for me.
> 
> Strangely, what's there as I found it is:
> 
>> # Print the status of the user's mailbox upon successful login.
>> session    optional     pam_mail.so standard noenv # [1]
> 
> And according to the pam_mail man page, the "noenv" is supposed to tell
> it to NOT set the $MAIL variable.
> 
> Just to see if it would make any difference, I changed it to:
> 
>> session    optional     pam_mail.so standard dev=~/Mail/
> 
> To see if it would make any difference.  It didn't.  Ssh'ing into the
> machine still results in $MAIL pointing to /var/mail/$USER (I even tried
> restarting the sshd daemon, but that made no difference).

Apparently, the "# [1]" part of the above isn't a comment. :-)  'Cause
when I changed the line to read:

> session    optional     pam_mail.so standard dev=~/Mail/ # [1]

It then started working.  Go figure. :-)  So never mind, then, it looks
like I managed to fix it after all.

              --Dave



Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: