Retrieving IP address of Client from Server

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums Programming Retrieving IP address of Client from Server
# 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.
# 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?

# 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.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #819
Difficulty: Medium
In CSS, E ~ F matches an F element preceded by an E element.
True or False?

10 More Discussions You Might Find Interesting

1. Web Development

How to enable x-client-ip address in apache webserver LogFormat?

how to enable x-client-ip address in apache webserver LogFormat i tried below option, but no luck... 1. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 2. LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy 3.... (0 Replies)
Discussion started by: raghur77
0 Replies

2. Shell Programming and Scripting

Retrieving file size in a remote server using SSH

Hi, I have public and private keys and that’s works fine for me. now I am sending files one by one on remote server and I want to check is file successfully delivered or not by comparing size of file on local machine and remote server using ‘stat –c%s’. Below operations need to be done on... (2 Replies)
Discussion started by: ketanraut
2 Replies

3. Programming

Client/Server Socket Application - Preventing Client from quitting on server crash

Problem - Linux Client/Server Socket Application: Preventing Client from quitting on server crash Hi, I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64. I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Discussion started by: varun.nagpaal
2 Replies

4. UNIX for Advanced & Expert Users

Determining IP address of NFS server on client

Hi. We use an Isilon cluster system to provide our NAS. The Isilon uses a round-robin DNS setup to spread mount requests across the many nodes of the cluster. When a node needs work, the filesystems that are mounted to it need to be moved to other nodes prior to shutting the node down. I... (2 Replies)
Discussion started by: rascalrick
2 Replies

5. Solaris

How to get the IP address / Host name of client machine

Hi How to get the IP address / Host name of a particular user connected to Unix Server. For example: If used 'DevUser1' is connected to Unix server. I need to find out from which PC this connection has been made. How can this be achieved? Thanks (6 Replies)
Discussion started by: MVL
6 Replies

6. IP Networking

ip address of a client

A client(PC) connects to an unix server via terminal emulator. How can I obtain that client's IP address? The unix server is an old SVR4.2 (NCR) and the "who" command does not show ip addresses. I need a command or a shell script or a C/C++ program that will help me to obtain the client's... (6 Replies)
Discussion started by: ka2d2
6 Replies

7. Programming

Getting IP Address of a client

I read an other post with a similar title but thios is different. here is a basic portion layout of our network Win PC 1 w/Refection X -- | Win PC 2 w/Refection X -- |-- 1 of 6 HP Unix servers -- Win 2k pc Win PC 3 w/Refection X -- ... (0 Replies)
Discussion started by: fayette
0 Replies

8. UNIX for Dummies Questions & Answers

client IP address

when working on a telnet is it possible the client machine accessing the server machine supply its IP Address to the server machine . The only other shell i can use is the TCL shell. (2 Replies)
Discussion started by: rolly
2 Replies

9. IP Networking

Client Ip Address

I have a UNIX daemon program which takes client connections via TCP/IP sockets. What I need to know is if there is any way of getting the IP address of the client socket once a connection has been made... or do I have to code my client to send it manually ? Thanks. (1 Reply)
Discussion started by: ovingtond
1 Replies

10. UNIX for Dummies Questions & Answers

IP address of telnet client

Hi, I am using the telnet client on windowsNT to access the Unix system. I want to find out the IP address of the telnet client from the server side. The reason is I want to set the DISPLAY environment variable when the user is logged on. Is there anyway that the the Unix server can... (1 Reply)
Discussion started by: vtran4270
1 Replies

Featured Tech Videos