Ubuntu Version:
24.04
How to enable the “You have new mail in” message when I connect via ssh ?
thnks
Ubuntu Version:
24.04
How to enable the “You have new mail in” message when I connect via ssh ?
thnks
That normally happens automatically when you have unread mail items in the local user mailbox for your user (when there’s an MTA installed on your system).
This usually happens automatically. If you don’t have any “new” messages since the last time you were logged in it won’t show.
However, this doesn’t correspond to your own external email address. It’s usually local to just that SSH user on that system.
I know it should normally happens but if not how can I enable it ?
I have postfix as MTA
If you haven’t changed your system’s environment and disabled the standard shell loading scripts, it’s already enabled.
The way to test this would be to have some process send your user@localhost a message while you are disconnected (via a cronjob or an anacron process or similar) that sends an email message via the MTA and delivers to your local user mailbox. That will make that message pop up.
However, unless you have a message to view, that notification won’t come up, even if you have the features enabled (which they are even in a minimal Ubuntu install).
Check /etc/pam.d/login : there are some options in there, I believe.
I viewed that file but, it is enabled
That file refers to /etc/login.defs ; in this file I changed
MAIL_DIR /var/mail
with
MAIL_DIR ~/Maildir/new
but it did not solved
Hmm. I’m not sure what needs to be done, but your MAIL_DIR define looks wrong to me: ~ does not ordinarily appear in system files.
[deleted] : examples I see on the net indicate mail ends up in a file /var/mail/klatls
The file /etc/login.defs is a system wide file
I cannot set a specific user’s home, setting ‘~’ means all users’s home
second point I use Maildir not mbox so emails are delivered to ~/Maildir
Anyway … I displayed the $MAIL variable on my ubuntu client and it is
/home/myuser/Maildir
or for root
/root/Maildir
so I set it in the ssh users’s server .bashrc
export MAIL=/home/myuser/Maildir
and this solved
This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.