Processes listening on Ports(Solaris)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Processes listening on Ports(Solaris)
# 1  
Old 12-06-2010
Processes listening on Ports(Solaris)

Howdy Experts,

This is my first post here and I am posting because I have not been able to find an answer for this question.
How do you find out what process is listening on a given port? I do not have "lsof" available and how do we find this out without logging in as Root.

I know that this has been brought up several times and I have tried those suggestions but I could never get it to work.
Im using Solaris 10.

Folks,
All help will be monumentally appreciated

Sincerely,
King Koopa
# 2  
Old 12-06-2010
Code:
#!/bin/ksh
        pfexec pfiles /proc/* 2>/dev/null | nawk -v port=$1 '
/^[0-9]/ { cmd=$0; type="unknown"; continue }
$1 == "SOCK_STREAM" { type="tcp" }
$1 == "SOCK_DGRAM" { type="udp" }
$2 == "AF_INET" {
        if ((port!="")&&($5!=port)) continue;
        if (cmd!="") {
                printf("%s\n    %s:%s/%s\n",cmd,$3,$5,type); cmd="";
        }
}'

---------- Post updated at 06:05 PM ---------- Previous update was at 06:04 PM ----------

oops... you said no root.... my oops...

you could always use sudo... true?
# 3  
Old 12-06-2010
you need root access of some form.
# 4  
Old 12-07-2010
so basically , I am a production support guy for this application XYZ , and i dont have root or sudo to root( thats the way things are here at my company) then there is no way i would be able to kill a rogue process that wont let go of my port? I can only su to a specific user that owns the application and thus the process owner would also be that very user.
Smilie

---------- Post updated at 11:24 AM ---------- Previous update was at 11:21 AM ----------

Can netstat not help me in this case?
# 5  
Old 12-07-2010
You can certainly run pfiles on processes you own. You only need to be root (or to have the rbac required privilege) for processes run by a different user.
# 6  
Old 12-07-2010
MySQL

This is awesome guys
this works !
YAYYYYYYYYY
you guys absolutely rock !
Jilliare , Frank_Rizzo and cjcox , thank you so much !
Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Ubuntu

PID of listening ports

I ran 'sudo netstat -ntpl' and got the following without PID tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:38977 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:34253 ... (3 Replies)
Discussion started by: tt77
3 Replies

2. Solaris

Solaris Ports

Hi can someone Explain me about Solaris Ports orientation, Like which all ports OS uses and which all is left for applications? (7 Replies)
Discussion started by: Sojourner
7 Replies

3. Solaris

Open ports in solaris 10

hi guys, may i know the exact steps to open a port in solaris.i have some rough idea - which is adding the port number in /etc/services. but i am not sure the correct conventions, steps or any other steps. kindly advise.thanks guys ! (1 Reply)
Discussion started by: cromohawk
1 Replies

4. Red Hat

No process ID for listening ports

How can I have ports that are listening without processes being associated with them? root@ldv002 # netstat -ltnup Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0... (2 Replies)
Discussion started by: Padow
2 Replies

5. Solaris

Ports on Solaris

please provide info. @ how to open ports in solaris? and how to check that which port assigns with which process. (5 Replies)
Discussion started by: ajitkraj
5 Replies

6. Solaris

open ports solaris 8

Hello, I have a number of Solaris 8 Sun servers that have open ports that I cannot identify. I see some with 1013-1023 (which are reserved ports according to the IANA. Lsof does not identify these. I rebooted the server and they went off, but this morning I saw they were all back on again. Any... (1 Reply)
Discussion started by: csgonan
1 Replies

7. UNIX for Dummies Questions & Answers

open ports solaris 8

Hello, I have a number of Solaris 8 Sun servers that have open ports that I cannot identify. I see some with 1012-1020 (which are reserved ports according to the IANA. Lsof does not identify these. One server has all these on and one server just has 1017. *.1023 ... (3 Replies)
Discussion started by: csross
3 Replies

8. UNIX for Dummies Questions & Answers

Nonprivileged ports on solaris

Is there a way to change a privileged TCP port (say 80) to a nonprivileged one.. (9 Replies)
Discussion started by: sssow
9 Replies

9. UNIX for Dummies Questions & Answers

TCP Listening Ports

Hello all, Can someone instruct me on how to change the listening port for ftp ( or any tcp service) from 21 to another port number? Thanks in advance.. -AJ (3 Replies)
Discussion started by: jacobsa
3 Replies
Login or Register to Ask a Question