Find the IP address that a telnet session uses

Thread Tools Search this Thread
Top Forums Programming Find the IP address that a telnet session uses
# 1  
Old 01-08-2002
Find the IP address that a telnet session uses

Hello Experts,
Happy New Year to all of us,

In AIX 4.3.3 I am trying to figure out how is possible to find out the IP address that a telnet session - user uses to login in to host machine. My objective is by finding the login IP address to allow the user to login or not.

All users uses the same .profile

I am trying to get information using the gethostbyaddr or gethostbyname functions.

Which value to I have to pass ftom .profile to the .c program such that provide the gethostbyaddr/gethostbyname with the right argument. In other words how I can pass from the .profile to .c program the IP address that is trying to log in.

Thanks in Advanced
# 2  
Old 01-08-2002
The gethostbyaddr returns a pointer to a hostent structure, which contains information obtained from one of the name resolutions services. The hostent structure is defined in the netdb.h file. Aka u can get the hostname of the connection, provided you know the ip address.

I dont get if the tcp server accepting connections is your program or it is any standard tcp server. If it is yours, then the listen(),accept() and inet_addr() will provide you with the ip address of the connection. If you dont know how it is done, this is it: Use first the socket(), then bind(), listen(),accept(),read(),close(),unlink(). Look for further details in your sockets reference manual in AIX.

If server is not yours, you can use the /etc/hosts.equiv file. I also dont get where the .profile gets involved.
# 3  
Old 01-08-2002
Search the forums for the utilility lsof .... this utility compiles on many platforms and does wonders for understanding and seeing the relationship of processes to open files descriptor and sockets.. plus much more!!!
# 4  
Old 01-10-2002
I tried this objective in SCO Unix with few lines scripting in .profile file:

for IP in `cat IPFile`
finger -fb | grep $IP > /dev/null
if [ $? -eq 0 ]
echo "You Are Not Allowed To Use Telnet Session In My System"

The IPFile contains all the IP's and hosts name in singular line format entry.
# 5  
Old 01-10-2002
I still dont get it. why dont u use /etc/hosts.equiv in AIX. Note that if u use your script, .profile can be bypassed.
# 6  
Old 01-18-2002

The main problem with /etc/hosts.equiv is that it is a VERY bad security hole.

By using IP spoofing, anyone can break into your system. There are other good ways to check the users when the login.

If someone can login as one of your users via /etc/hosts.equiv that could be very dangerous.

Is /etc/securetty an option?
# 7  
Old 01-22-2002
Yes, but I assumed it was a local environment or something to use such a script. If it is public, then I guess he has to move to something more sophisticated like using firewalls. You can also download openssh for AIX that provides a good level of security, check If more security is needed TCB should be considered.

Greetings Theodore
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. HP-UX

ssh session getting hung (smilar to hpux telnet session is getting hung after about 15 minutes)

Our network administrators implemented some sort of check to kill idle sessions and now burden is on us to run some sort of keep alive. Client based keep alive doesn't do a very good job. I have same issue with ssh. Does solution 2 provided above apply for ssh sessions also? (1 Reply)
Discussion started by: yoda9691
1 Replies

2. UNIX for Dummies Questions & Answers

Disconnecting a telnet session

How can I disconnect an existing telnet session? The host is a serial port server with multiple ports. The users login using the host's name and a port, i.e. telnet host01 1235. Thanks. (14 Replies)
Discussion started by: cooldude
14 Replies

3. UNIX for Dummies Questions & Answers

Telnet Session to AIX

Hello, I have AIX 5.3 at home connected to netgear router. Port Forwarding has been enabled on the router. Problem is that if I want to telnet, I have to try 2 or 3 times before I can get a logon prompt. It times out for first or second time (Connection to session <IP_Address> failed: Connection... (1 Reply)
Discussion started by: bluebee
1 Replies

4. UNIX for Dummies Questions & Answers

Unix Telnet session

Hi Is there any way whilst in a telnet session you can view your client machine name that you are using to connect to the Unix box ? :eek: (2 Replies)
Discussion started by: mlucas
2 Replies

5. IP Networking

intercept the ip address of a telnet session

The situation: a Unix system (UnixWare 7.1.3) to which are connected other systems; various p.c. on the LAN that they connect Unix to the system via TelNet. The problem: I need to intercept the address IP of the p.cs. connected via telnet to the Unix system. Particularly, I have to know the... (2 Replies)
Discussion started by: paololrp
2 Replies

6. Shell Programming and Scripting

Telnet Session

{ sleep 2 echo "$user" sleep 2 echo "$password" sleep 2 echo " ls" sleep 10 echo "exit" }| telnet $server I have a machine x and i have executed the above script on machine 'x'. i entered the... (6 Replies)
Discussion started by: pathanjalireddy
6 Replies

7. Shell Programming and Scripting

Telnet session does not expire

Dear friends.. Our project has a module that runs on handheld devices. Through the handheld we telnet to solaris where the application actually runs. I noticed that after starting a session through the handheld, if i go out of range or if i remove and replace the battery in the handheld, the... (1 Reply)
Discussion started by: deepsteptom
1 Replies

8. UNIX for Advanced & Expert Users

Host IP address for a telnet session

I am using Tru64UX 5.1a on alphaserver 4100. Users access the application through Telnet sessions to this server. My requirement is to limit the users login through their PCs only. Is there any way I can accomplish this on the unix box ? I want to include a script in the .profile ( or... (1 Reply)
Discussion started by: shauche
1 Replies

9. UNIX for Dummies Questions & Answers

telnet session timeout

hi, we can set something such that if the user has been idle for a while, it will auto disconnect. where to do so? thanks (6 Replies)
Discussion started by: yls177
6 Replies
Login or Register to Ask a Question