Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Print number of messages in mail spool at login [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dwn
n00b
n00b


Joined: 23 Dec 2003
Posts: 24

PostPosted: Wed Mar 17, 2004 12:16 pm    Post subject: Print number of messages in mail spool at login [solved] Reply with quote

Today, as I sshed into my school's UNIX server, I noticed that everytime I logged in, the terminal would tell me whether I had new messages in my mail spool or not. For example, "You have mail." or "No new mail.". I was wondering if someone knew, off the top of their head how to set that up. Would it be just a bash script checking the return type of:
Code:
$ mail -e
and printing out the apporpiate responce? Or is there something a little more fancy? Thanks.


Also, when I was trying to compile net-mail/mailutils-0.3 I got this compile error:
Code:
mu_auth.c:89:13: pasting "->" and "name" does not give a valid preprocessing token
mu_auth.c:89:13: pasting "," and "name" does not give a valid preprocessing token
mu_auth.c:89:13: pasting "(" and "name" does not give a valid preprocessing token
mu_auth.c:90:15: pasting "->" and "passwd" does not give a valid preprocessing token
mu_auth.c:90:15: pasting "," and "passwd" does not give a valid preprocessing token
mu_auth.c:90:15: pasting "(" and "passwd" does not give a valid preprocessing token
mu_auth.c:91:14: pasting "->" and "gecos" does not give a valid preprocessing token
mu_auth.c:91:14: pasting "," and "gecos" does not give a valid preprocessing token
mu_auth.c:91:14: pasting "(" and "gecos" does not give a valid preprocessing token
mu_auth.c:92:12: pasting "->" and "dir" does not give a valid preprocessing token
mu_auth.c:92:12: pasting "," and "dir" does not give a valid preprocessing token
mu_auth.c:92:12: pasting "(" and "dir" does not give a valid preprocessing token
mu_auth.c:93:14: pasting "->" and "shell" does not give a valid preprocessing token
mu_auth.c:93:14: pasting "," and "shell" does not give a valid preprocessing token
mu_auth.c:93:14: pasting "(" and "shell" does not give a valid preprocessing token
mu_auth.c:94:16: pasting "->" and "mailbox" does not give a valid preprocessing token
mu_auth.c:94:16: pasting "," and "mailbox" does not give a valid preprocessing token
mu_auth.c:94:16: pasting "(" and "mailbox" does not give a valid preprocessing token
mu_auth.c: In function `mu_get_auth_by_name':
mu_auth.c:168: warning: passing arg 3 of `mu_auth_runlist' discards qualifiers from pointer target type
gcc -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/share/locale\" -I. -I. -I.. -I../include -I../mailbox -I../mailbox/include -I../include/mailutils/gnu -DSYSCONFDIR=\"/etc\" -DSITE_VIRTUAL_PWDDIR=\"/etc/domain\" -march=pentium2 -O3 -pipe -fomit-frame-pointer -MT mu_argp.lo -MD -MP -MF .deps/mu_argp.Tpo -c mu_argp.c -o mu_argp.o >/dev/null 2>&1
make[3]: *** [mu_auth.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
mv -f .libs/mu_argp.lo mu_argp.lo
make[3]: Leaving directory `/var/tmp/portage/mailutils-0.3/work/mailutils-0.3/mailbox'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/mailutils-0.3/work/mailutils-0.3/mailbox'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/mailutils-0.3/work/mailutils-0.3'
make: *** [all] Error 2

!!! ERROR: net-mail/mailutils-0.3 failed.
!!! Function src_compile, Line 41, Exitcode 2
!!! (no error message)

Any idea why? Thanks again.


Last edited by dwn on Tue Apr 27, 2004 11:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Mar 17, 2004 2:07 pm    Post subject: Reply with quote

Uncomment the mailcheck lines in
/etc/pam.d/login or /etc/pam.d/ssh, or whatever program of your choice.
That will give you the standard mailcheck.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
dwn
n00b
n00b


Joined: 23 Dec 2003
Posts: 24

PostPosted: Wed Mar 17, 2004 2:48 pm    Post subject: Reply with quote

This is the contents of /etc/pam.d/login
Code:
#%PAM-1.0

auth       required     /lib/security/pam_securetty.so
auth       required     /lib/security/pam_stack.so service=system-auth
auth       required     /lib/security/pam_nologin.so

account    required     /lib/security/pam_stack.so service=system-auth

password   required     /lib/security/pam_stack.so service=system-auth

session    required     /lib/security/pam_stack.so service=system-auth
session    optional     /lib/security/pam_console.so
/etc/pam.d/sshd isn't any more help.
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Mar 17, 2004 2:50 pm    Post subject: Reply with quote

You want to add
Code:
session optional pam_mail.so standard noenv

to those files.
I thought it would be included & commented by default, but there you have it...
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
dwn
n00b
n00b


Joined: 23 Dec 2003
Posts: 24

PostPosted: Wed Mar 17, 2004 7:59 pm    Post subject: Reply with quote

excellent, thanks adaptr

--edit:

Okay, I did that and I works in so far as it runs =)
...but I am finding this error in my /var/log/auth.log
Code:
Mar 17 17:52:10 dwn sshd[8521]: Accepted keyboard-interactive/pam for dwnadmin from 192.168.0.125 port 34288 ssh2
Mar 17 17:52:10 dwn sshd(pam_unix)[8525]: session opened for user dwnadmin by (uid=0)
Mar 17 17:52:10 dwn PAM-mail[8525]: conversation failure [Conversation error]


I have added the debug argument to the line, but the debug information isn't showing up in my syslog... Ideas?
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Thu Mar 18, 2004 9:28 am    Post subject: Reply with quote

Do you get the mail notification ?
If so, it may be a trivial thing, if not - you probably need one ore more PAM modules.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
dwn
n00b
n00b


Joined: 23 Dec 2003
Posts: 24

PostPosted: Thu Mar 18, 2004 6:24 pm    Post subject: Reply with quote

No, I don't get the mail notification.

I figured out the problem with emerging mailutils, I just emerged 3.1 instead of 3.0 and it worked, so if I cannot get this PAM module to work it is not the end of the world since I can just make a simple if statement:
Code:
if ( `mail -e` ); then echo "you have mail";fi

and throw that into the login script. But, I would prefer to get that working.
Back to top
View user's profile Send private message
dwn
n00b
n00b


Joined: 23 Dec 2003
Posts: 24

PostPosted: Tue Apr 27, 2004 11:28 pm    Post subject: Reply with quote

Okay, I just updated to net-misc/openssh-3.8_p1 and it solved everything. I had added the mail pam module to the pam sshd config.
Code:
# echo 'session    optional     pam_mail.so debug standard' >> /etc/pam.d/sshd
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum