Get user name from ip address


 
Thread Tools Search this Thread
Top Forums Programming Get user name from ip address
# 1  
Old 11-21-2006
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
# 2  
Old 11-21-2006
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  
Old 11-21-2006
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  
Old 11-21-2006
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  
Old 11-21-2006
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  
Old 11-21-2006
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  
Old 11-21-2006
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
Tornado
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

MySQL select user with the same IP address

Dear community, I woul like to make a query to output all the users having the same IP address. The table is somethig like: name logged_ip ==== ========= user1 127.0.0.1 user2 127.0.0.2 user3 127.0.0.3 user4 127.0.0.1 user5 127.0.0.2 user6 127.0.0.5I used this query... (4 Replies)
Discussion started by: Lord Spectre
4 Replies

2. UNIX for Dummies Questions & Answers

To find the Ip address of the user who deleted files

Hi, There were a few files deleted from a server by user xyz. The file names are:- /oraextME4/oradata/ME11G22/TEST_IMPORT_01.dbf /oraextME4/oradata/ME11G22/RKVITR1_03.dbf /oraextME4/oradata/ME11G22/TEST_IMPORT_02.dbf need to know the ip address of the terminal from which that... (10 Replies)
Discussion started by: Abhinav Jaiswal
10 Replies

3. Shell Programming and Scripting

Email sent to multiple user address?

hi all, This is user that i want sent the email: Email = allan@gmail.com bruce8899@gmail.com Chris@gmail.com echo "$dir : $filecount is over the limit $limit " | mailx -s "${SUBJECT}" "${email}" However it cannot sent to 3 user..only sent to 1 user email address. Any 1 can help me... (15 Replies)
Discussion started by: proghack
15 Replies

4. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

5. OS X (Apple)

Ho do I masquerade the "user@user.local" address in mail/mailx?

Hi, I'm brand new here and looking for a solution: I'm using mail or mailx. The default reply address is «myshortusername@mylongusername.local» which makes absolutely no sense for anybody receiving my emails. But how do I change it? There seem to be many solutions but none for Mac OS X.... (0 Replies)
Discussion started by: gczychi
0 Replies

6. UNIX for Advanced & Expert Users

Can kernel process access user address space ?

Can kernel process access user address space ? (2 Replies)
Discussion started by: subhotech
2 Replies

7. UNIX for Dummies Questions & Answers

remote user ip address

can anybody help me to get a remote user ip address in SCO 5.0.5 (5 Replies)
Discussion started by: naushad
5 Replies

8. Shell Programming and Scripting

replace <Address> with a var input by user

Hi, All here is not a full version script, just post a sample. #/bin/bash read -p 'Addr: ' addr sed 's/<Address>/'"$addr"'/' pf.mod>$1 If the input string include `/', sed will return error message. I know that s/// can be replaced with s::: or s!!!, etc, but the input var can accept... (4 Replies)
Discussion started by: r2007
4 Replies

9. UNIX for Dummies Questions & Answers

Locate a user by their IP address

We have a user that is sending rather large print jobs to a windows printer, we need to track them down and advise a sensible approach to printing. The only thing that shows up in the windows print manager is the IP address of the source. Is this achievable? :confused: (7 Replies)
Discussion started by: jagannatha
7 Replies
Login or Register to Ask a Question