home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / sun / admin / 8623 < prev    next >
Encoding:
Internet Message Format  |  1992-11-24  |  2.0 KB

  1. Xref: sparky comp.sys.sun.admin:8623 comp.unix.admin:6353 comp.unix.programmer:5410 comp.unix.wizards:4874
  2. 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
  3. From: usmyrtle@mcs.drexel.edu (Steven Myrtle)
  4. Newsgroups: comp.sys.sun.admin,comp.unix.admin,comp.unix.programmer,comp.unix.wizards
  5. Subject: revisited, determining if anyone else is logged on
  6. Message-ID: <1992Nov23.234245.18246@mcs.drexel.edu>
  7. Date: 23 Nov 92 23:42:45 GMT
  8. Sender: usmyrtle@mcs.drexel.edu (Steven Myrtle)
  9. Organization: Drexel University
  10. Lines: 29
  11.  
  12. Not so long ago I wrote...
  13.  
  14. >What's the best way under SunOS 4.1.x to determine if anyone besides
  15. >the owner of the console is logged onto the machine?  Searching the
  16. >utmp file?  Searching the process table?  (My program will be setuid
  17. >root, so that is an option, although I would prefer a simpler
  18. >solution.)  Other suggestions are greatly welcomed?
  19.  
  20. Since then, I have gotten way too much mail telling me about w, who,
  21. finger, etc., and how to do things from within a script.  I know all
  22. about doing it from within a script.  But I'm not talking about a
  23. script.  I thought me mentioning "My program will be setuid root"
  24. would make that clear.  Apparently not.  I suppose people didn't notice
  25. that tidbit of information, or else almost everyone uses the words
  26. "program" and "script" without distinction.  Some people have gotten
  27. closer to what I'm asking for.  They suggested I use system(), fork(),
  28. execl(), etc., to execute a w, who, finger, etc.  But I don't at all
  29. consider doing that from within a setuid program to be a good practice,
  30. and I won't do it.
  31.  
  32. I'm looking for 100% C code that doesn't need to do execl()'s in any way,
  33. shape, or form.  I know all about reading the utmp file, but I'm looking
  34. for a better method since the utmp file isn't 100% reliable.
  35.  
  36. As before, please email me if you have some ideas, but please, no more w's,
  37. who's, finger's, etc.!  Do NOT mail me after 12/1.
  38.  
  39. Thanks,
  40. Steven (usmyrtle@mcs.drexel.edu)
  41.