Summary: Testing for su verses remote login

From: Donovan, Jeffrey (Jeff), ALABS <jmd_at_att.com>
Date: Thu Feb 05 2004 - 02:18:58 EST
Question was:

I want to suppress login messages from /etc/profile (ie; you have mail,
motd, etc)  if su is used to login to a user but don't suppress if it's
a remote login. How do you test in /etc/profile whether a login came
remotely ie; telnet/rsh/ssh or was locally done with su.

Got replies from:

Jon Godfrey
David Ledger
Jesse Trucks

These two suggestions I tried and worked:


David Ledger replied:
Check the parent process ($PPID).  It will be a shell for an 'su' and
telnetd/rlogind or whatever for the others.


Jesse Trucks replied:
Compare the output of /usr/ucb/whoami and /bin/logname. /bin/logname
will output the original login user, and whoami will show who your
effective user is.


Thanks again to all who replied.

This mail list is a great tool, better than Sunsolve!

Jeff



_____________________________________________

Hi all,

Hope this is an easy one.  I want to suppress login messages from
/etc/profile (ie; you have mail, motd, etc)  if su is used to login to a
user but don't suppress if it's a remote login. How do you test in
/etc/profile whether a login came remotely ie; telnet/rsh/ssh or was
locally done with su.

Thanks for the help

Jeff
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu Feb 5 02:18:39 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:29 EST