home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / admin / 6155 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  2.1 KB

  1. Path: sparky!uunet!portal!lll-winken!fnnews.fnal.gov!fnsony.fnal.gov!shah
  2. From: shah@fnsony.fnal.gov (Hemant Shah)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: Identifying user's remote IP address at login?
  5. Message-ID: <1duaqkINNj2o@fnnews.fnal.gov>
  6. Date: 12 Nov 92 19:20:52 GMT
  7. References: <1992Oct29.004719.9096@news.ysu.edu> <BxM36A.5HA@wang.com>
  8. Reply-To: shah@fnalb.fnal.gov
  9. Organization: Fermi National Accelerator Laboratory, Batavia, IL
  10. Lines: 41
  11. NNTP-Posting-Host: fnsony.fnal.gov
  12.  
  13. In article <BxM36A.5HA@wang.com>, fredj@wang.com (Fast Freddie) writes:
  14. |> ae954@yfn.ysu.edu (Andy Johnston) writes:
  15. |> 
  16. |> 
  17. |> >I am trying to set up a system in which a utility called
  18. |> >from the .login file can identify the IP address (or system name)
  19. |> >of a remote user at login and perform a
  20. |> >    setenv DISPLAY <user's system>:0
  21. |> >to make X displays pop up in the right place.
  22. |> 
  23. |> >The utmp file only has 16 characters reserved for the remote
  24. |> >name and is often truncated, so it isn't always reliable.
  25. |> What you can do is scan/grep the utmp file for the 16 characters.  Cut that
  26. |> out and grep the etc/hosts file, cutting out the first field which usually
  27. |> is the internet address.
  28. |> Fast Freddie
  29.  
  30. Here's how I am doing it. Create a shell script "$HOME/bin/set_disp" as follows:
  31.  
  32. ------------- 8< ----------- begin set_disp shell script ------- 8< ------
  33. #!/bin/sh
  34.  
  35. TTY=`tty | cut -d / -f 3`
  36. finger shah | grep "$TTY" | nawk '{print $NF}' | sort -u
  37.  
  38. ------------- 8< ----------- end set_disp shell script ------- 8< ------
  39.  
  40. add following entry in you .login file:
  41.  
  42. setenv DISPLAY `$HOME/bin/set_disp`:0
  43.  
  44. Hope this helps :-)
  45. -- 
  46. -------------------------------------------------------------------------------
  47. Hemant Shah                            | All the opinions expressed are my own
  48. Fermi National Accelerator Laboratory  | and does not necessarily reflect
  49. Systems Integration Group              | those of Fermilab.
  50. E-mail :shah@fnal.fnal.gov             |
  51.  Voice : (708) 840-8071                   | I haven't lost my mind
  52.    Fax : (708) 840-2783                | it's backed on tape somewhere.
  53. -------------------------------------------------------------------------------
  54.