home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.admin:8623 comp.unix.admin:6353 comp.unix.programmer:5410 comp.unix.wizards:4874
- Path: sparky!uunet!olivea!charnel!rat!usc!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!netnews.upenn.edu!netnews.noc.drexel.edu!king.mcs.drexel.edu!king.mcs.drexel.edu!usmyrtle
- From: usmyrtle@mcs.drexel.edu (Steven Myrtle)
- Newsgroups: comp.sys.sun.admin,comp.unix.admin,comp.unix.programmer,comp.unix.wizards
- Subject: revisited, determining if anyone else is logged on
- Message-ID: <1992Nov23.234245.18246@mcs.drexel.edu>
- Date: 23 Nov 92 23:42:45 GMT
- Sender: usmyrtle@mcs.drexel.edu (Steven Myrtle)
- Organization: Drexel University
- Lines: 29
-
- Not so long ago I wrote...
-
- >What's the best way under SunOS 4.1.x to determine if anyone besides
- >the owner of the console is logged onto the machine? Searching the
- >utmp file? Searching the process table? (My program will be setuid
- >root, so that is an option, although I would prefer a simpler
- >solution.) Other suggestions are greatly welcomed?
-
- Since then, I have gotten way too much mail telling me about w, who,
- finger, etc., and how to do things from within a script. I know all
- about doing it from within a script. But I'm not talking about a
- script. I thought me mentioning "My program will be setuid root"
- would make that clear. Apparently not. I suppose people didn't notice
- that tidbit of information, or else almost everyone uses the words
- "program" and "script" without distinction. Some people have gotten
- closer to what I'm asking for. They suggested I use system(), fork(),
- execl(), etc., to execute a w, who, finger, etc. But I don't at all
- consider doing that from within a setuid program to be a good practice,
- and I won't do it.
-
- I'm looking for 100% C code that doesn't need to do execl()'s in any way,
- shape, or form. I know all about reading the utmp file, but I'm looking
- for a better method since the utmp file isn't 100% reliable.
-
- As before, please email me if you have some ideas, but please, no more w's,
- who's, finger's, etc.! Do NOT mail me after 12/1.
-
- Thanks,
- Steven (usmyrtle@mcs.drexel.edu)
-