Email Address Password
Remember Me

Or Create a (Free) Account.
2004JanFebMarAprMayJunJul Aug Sep Oct Nov Dec
2005 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2006 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Oct Oct
2007JanFebMarAprMayJunJulAugSepOctNovDec2007
2008JanFebMarAprMayJunJulAugSepOctNovDec2008
2009JanFebMarAprMayJunJulAugSepOctNovDec2009
2010JanFebMarAprMayJunJulAugSepOctNovDec2010
2011JanFebMarAprMayJunJulAugSepOctNovDec2011
2012JanFebMarAprMayJunJulAugSepOctNovDec2012
2013JanFebMarAprMayJunJulAugSepOctNovDec2013

Fri 3rd Aug 2012 @ 08:56 2012: Find owner of port on AIX

On AIX, if lsof is not available, this technique can be used to determine the owner of an open port:

# netstat -Aan|grep 6014
f100060000a69398 tcp6 0 0 ::1.6014 *.* LISTEN
f100060000a4b398 tcp4 0 0 127.0.0.1.6014 *.* LISTEN

We are interested here in the tcp4 socket, reference f100060000a4b398. Any attempt to remove this socket will fail, because it is in use by an existing process. It is therefore safe to use the rmsock command, fully expecting failure, because the failure message passes on the relevant details from the kernel data structures:
# rmsock f100060000a4b398 tcpcb
The socket 0xa69008 is being held by process 3412026 (sshd).

This allows us to investigate the process in question, and and we can go have a word with the Oracle DBA about the ssh session.
# ps -fp 3412026 
UID PID PPID C STIME TTY TIME CMD
oracle 3412026 3522712 0 09:06:23 - 0:00 sshd: oracle@pts/5

Post a Comment               

Steve's urandom blog
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon
My Shell Scripting Book:
    Shell Scripting, Expert Recipes for Linux, Bash and more
is available online and from all good booksellers:


DefectiveByDesign.org