LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-27-2010, 05:52 AM   #1
esquivalient
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Rep: Reputation: 0
Identify client process initiating TCP connection port 113


From my firewall logs, I've got a process n a Centos host attempting to initiate a connection to the auth daemon (which isn't running) on another server. In order to clean things up, I'd like to identify which process is periodically making this attempt, and stop it.

I've been playing around with "watch" and "ss" but so far, to no avail. I can see the calls with tcpdump, but can't track the process ID back to a process.

Has anyone got any ideas for a way to identify the process, given that it's an intermittent attempt?
 
Old 12-27-2010, 07:00 AM   #2
gratuitous_arp
LQ Newbie
 
Registered: Jul 2009
Posts: 28

Rep: Reputation: 17
There would be much cleaner ways of doing this, but here is some direction for an easy way. On the system initiating the connection:

- Use iptables to match the traffic you're interested in and LOG it, which will write a message to /var/log/syslog
- Use a file watcher of your choice to read every syslog message and "grep" for the log messages generated by iptables for your match. If you want to take action multiple times, rather than just once, incron may be helpful to you here rather than something like tailf.
- Anytime you find a match, run netstat -nap. This will show you the TCP port in whatever state, as well as the process ID and name responsible for it. Run grep for the port you're interested in to cut down on spam.

That should be enough to get you going.
 
Old 12-27-2010, 09:38 AM   #3
esquivalient
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Original Poster
Rep: Reputation: 0
In the end, I just used:
# watch -d "netstat -anp | grep 113"

and waited until something popped up. Turned out exim is hitting the non-existent authd. Now to find out why.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tcp client socket : how to get own port number ?? vlyamtse Programming 2 10-01-2010 07:26 PM
Kill process hogging tcp port Ephracis Linux - General 1 02-25-2010 12:26 PM
Finding the Process ID of a Process While Initiating the Process senthilmuthiah Linux - Newbie 7 04-02-2009 10:37 AM
security port 113/TCP procfs Linux - Security 2 04-21-2006 03:21 AM
Process and TCP Port jonty_11 Programming 7 02-22-2005 06:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration