Login shell?

John Chambers jc at minya.UUCP
Thu Nov 17 14:59:37 AEST 1988


In article <331 at uplog.se>, thomas at uplog.se (Thomas Hameenaho) writes:
> In article <1829 at ogccse.ogc.edu> schaefer at ogccse.UUCP (Barton E. Schaefer) writes:
> >I have no experience with SysV, so somebody else will have to tell
> >me if this does not work there.  But on BSD, why not:
> >    1) Use "ps xl" (produces the PARENT pid as well as the pid)
> >    2) Grep for the pid
> >    3) Check the parent pid; if `1', then you have a login shell
> >
> 
> This is not completely fool-proof either. If you have shell that isn't the
> login shell and you manage to kill the parent of this shell without killing
> the shell itself this shell winds up having a PPID of 1.
> 
Another case where it won't work:  Some time ago, I posted an alternate
login daemon to comp.unix.sources called "uutty", named to imply that it
understands uucp and with a "-L" option creates uucp lockfiles during a
login session to warn uucp away from the port.  (It also does things like
allowing use of the port in both directions, as it backs off silently when
a uucp lockfile appears).  In order for this to work, it has to stay in
the background during a session, else there is no way for it to know to
remove the lockfile when you log out.  So your login shell ends up having
uutty as its parent.

I've noticed that quite a few other people are talking seriously about
writing their own login daemon.  (Go ahead; it's fun. :-)  Some of them
will end up doing something similar.  So checking for (ppid==1) will be
even less useful in the future than it is now.

-- 
John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393)

[Any errors in the above are due to failures in the logic of the keyboard,
not in the fingers that did the typing.]



More information about the Comp.unix.questions mailing list