Summary: Testing for su verses remote login

From: Donovan, Jeffrey (Jeff), ALABS (jmd@att.com)
Date: Wed Feb 04 2004 - 14:37:46 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



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:58 EDT