![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ip address of a client | ka2d2 | IP Networking | 6 | 11-26-2007 02:44 PM |
| Getting IP Address of a client | fayette | High Level Programming | 0 | 03-24-2006 11:27 AM |
| client IP address | rolly | UNIX for Dummies Questions & Answers | 2 | 03-17-2005 06:14 PM |
| Client Ip Address | ovingtond | IP Networking | 1 | 09-15-2003 02:45 PM |
| IP address of telnet client | vtran4270 | UNIX for Dummies Questions & Answers | 1 | 09-12-2002 01:34 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Retrieving IP address of Client from Server
Hi All,
When I connect to a unix server from a client machine, how can I get the IP address of the client? One way of retrieving IP address of client which initiates an active connection to the server is through /var/adm/utmpx file upon login; client's IP address and other info would have been dumped into the file, I just made use of utmpx structure to read the file with identification of line I am currently working and the loginname I was able to retrieve the client's IP address. And that is how who command works i just found one such similiar thread. similiar thread But I am searching for a method, to directly determine the client's IP address without depending on a file. Any pointers on that!!! Thanx in Advance. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Use lsof on the parent of the shell.
|
|
#3
|
|||
|
|||
|
executing lsof on parent of the shell (login pid)
results in /dev/kmem error. But how would this identify the client connected to the Server? Thanks!!! |
|
#4
|
||||
|
||||
|
First you need a working lsof. The parent of the shell will be telnetd or something like that. It will have a connected socket to the client. lsof can display that socket.
|
|
#5
|
|||
|
|||
|
Thanks for the reply Per,
shell spawned by login process which in turn is spawned by in.telnetd, where each instance of in.telnetd is dedicated to each of the login process. And in.telnetd should have the status of the active socket connection with the client which had initiated an active request. And one more way, use pfiles <in.telnetd pid> since i dont have root permission i was just thinking of alternate way. |
|||
| Google The UNIX and Linux Forums |