![]() |
|
|
|
|
|||||||
| 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 |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 05:12 PM |
| sendmail "root... User address required." error | csgonan | SUN Solaris | 10 | 04-03-2008 06:57 AM |
| replace <Address> with a var input by user | r2007 | Shell Programming and Scripting | 4 | 06-16-2005 09:14 AM |
| network address and broadcast address? | pnxi | UNIX for Dummies Questions & Answers | 7 | 11-10-2003 08:29 PM |
| Locate a user by their IP address | jagannatha | UNIX for Dummies Questions & Answers | 7 | 05-22-2003 01:28 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Get user name from ip address
hi all
i am new in unix programming i want some help from this forum, i want to know how to get user name of other machine in local network from its ip address or suggest any books for networking programming on unix sachin |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
User name? Or do you mean hostname? The usernames on a system usually won't have anything to to with the IP address of that system.
|
|
#3
|
|||
|
|||
|
host name
thank for this quick reply
so please tell about how to get host name from ip address, if you have any idea about web link or book about this problem please forward me |
|
#4
|
||||
|
||||
|
There are a few ways.
Not using C: Use actual unix commands instead of C library functions. Two of the methods are using grep on the /etc/hosts file, and using nslookup/dig. In a C program, you can use these via popen and fread/fgets/fscanf on the file pointer returned by popen. Using C: Take a look at the man page of gethostbyname/gethostbyaddr. |
|
#5
|
|||
|
|||
|
http://www.amazon.com/Unix-Network-P...e=UTF8&s=books
Unix Network Programming, Vol. 1: The Sockets Networking API, Third Edition. ISBN: 0131411551 This book is absolutely priceless when learning anything about network comm. in Unix. |
|
#6
|
|||
|
|||
|
another way if you are not using dns or /etc/hosts is:
ssh <ip> "hostname" but you'll need a userpasswort on the machine or telnet or rlogin or whatever |
|
#7
|
||||
|
||||
|
Or just use ping..
# ping -s 192.168.1.1 2 2 PING 192.168.1.1: 2 data bytes 10 bytes from mercury (192.168.1.1): icmp_seq=0. 10 bytes from mercury (192.168.1.1): icmp_seq=1. ----192.168.1.1 PING Statistics---- 2 packets transmitted, 2 packets received, 0% packet loss # This shows that IP 192.168.1.1 is mercury |
||||
| Google The UNIX and Linux Forums |