LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-06-2012, 07:51 AM   #1
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
port availability- linux redhat 5


Hi All,

I am using "lsof -i:<Port Number>" & "netstat -anp| grep <port number>" commands to check
the free ports available on my Linux(redhat) machine.

But the problem with above commands is that, it wont show the process details of a particular port
if it is running from an user account which is different with which i logged in.

Do we have any command or work around by which we can check whether a port is owned by any process (or any other user account )
even if we dont have root access.

Please suggest
 
Old 12-06-2012, 09:40 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Pretty sure it's not possible, maybe you can run it via sudo securely?
 
Old 12-06-2012, 09:42 AM   #3
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
oh seriously , so there is no way out to find the ports owned by different user accounts as i dont have root or sudo access
 
Old 12-06-2012, 11:02 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Actually, if you try eg netstat as non-root, it actually tells you this
Code:
 netstat -tanp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
 
Old 12-06-2012, 11:33 PM   #5
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
I am not able to see the non-owned process info for a particular port,so only ROOT can check which all ports are owned by users
 
Old 12-07-2012, 02:13 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by chrism01 View Post
Actually, if you try eg netstat as non-root, it actually tells you this
Code:
 netstat -tanp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
you got the options wrong, it should be -pant. Sadly -s can't be used, otherwise I'd get to write -pants a dozen times a day. ;-)
 
Old 12-07-2012, 03:52 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Nice
 
Old 03-12-2013, 06:02 AM   #8
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
I am still getting below error , when i am using netstat -pant| grep 10003.It doesnt give the desired result


(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
 
Old 03-12-2013, 10:28 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by vicky007aggrwal View Post
I am still getting below error , when i am using netstat -pant| grep 10003.It doesnt give the desired result


(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Where does it say that's an error? It clearly says that you need to be root... what else are we suppose to add?
 
Old 03-12-2013, 10:49 AM   #10
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
I mean without being root does this mean that i cannot locate the process running on particular port if it is owned by differnt user id with which i logged in ?
 
Old 03-12-2013, 11:02 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
yes, that would be a privilege violation if it were possible.
 
1 members found this post helpful.
Old 03-12-2013, 01:18 PM   #12
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks chris
 
  


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
Redhat 5 High Availability Add-on he2yman Red Hat 3 10-21-2012 06:18 AM
High Availability (HA) and Load Balancing on single centos-6 or redhat-6 cluster linuxrndblog Linux - Server 8 12-02-2011 11:25 AM
port forwarding using redhat enterprice linux 4 kashif2131971 Linux - Networking 1 07-19-2009 10:41 PM
Availability of Redhat kernels svyshna Linux - General 1 09-11-2003 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 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