Login shell?
William E. Davidsen Jr
davidsen at steinmetz.ge.com
Wed Oct 26 06:44:26 AEST 1988
In article <314 at uplog.se> thomas at uplog.UUCP (Thomas Hameenaho) writes:
| One way of deciding wether or not the current shell is the login shell
| is the fact that the name of the login shell is prependended with a '-'.
| If for instance I run tcsh as my login shell it will be exec:ed with
| -tcsh as argv[0].
Only in a trusted environment. I can change the strings in the exec
call so that the first argument is not the same as the program name. A
better way is to check the PPID if your system has a known PID for init.
Other than that you're on your own, but remember if you want to run
something like "ps" to use the full pathname, at least.
Most of the techniques mentioned are highly useful in a well behaved
environment in which you are trying to avoid initialization or some
such, but less reliable in the case where someone may be tricking your
program into thinking it's a login shell.
--
bill davidsen (wedu at ge-crd.arpa)
{uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
More information about the Comp.unix.questions
mailing list