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