I need for a script to capture the ip address from the connected user.
I have 5 logical partitions.
With "who", i have the ip adress, but only for 2 servers.
Do you know another command to know the ip address of connected clients ?
thank you, but i need to capture the IP of the last login.
To explain, i try to automatically launch a program when a user connect (with .profile), and this program need the IP adress.
thank you
Thank you for your response
But When i write it, I have the result :
root pts/2 Jan 26 09:06 still logged in
root pts/2 Jan 26 09:06 - 09:06 (00:00)
and no IP that's my problem, the ip for who, last, etc... isnot given.
For precision, i use ssh.
It is a p570 with 6 virtual partitions. Only this partition has this problem (all use ssh )
I'm going to strike out on that one. I'm curious why your /etc/utmp isn't reporting the IP address. Perhaps you could delete the /etc/utmp (move it to another name rather) and let it create a new one.
Does the 'last' command report an IP address? Try:
I can't find any other way to determine the connecting IP address. I would now try to figure out why the who command isn't reporting the ip address -- that is the root of the problem.
Do you have lsof? Code in .profile can trace back from the current shell to the instance of the program that provides the socket i/o (telnetd, sshd, etc) and use lsof to get the remote ip.