Whats Up Doc
George Toft
plug-discuss@lists.plug.phoenix.az.us
Mon, 11 Nov 2002 22:07:04 -0500
shadow wrote:
>
> > The Unix solution is netstat. Ask netstat for all listening connections
> > like this:
> > $ netstat -a | grep LISTEN
>
> Since unix treats everything as a file, you could also use lsof like this:
>
> $ lsof -i
> COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
> ntpd 183 root 4u IPv4 274 UDP *:ntp
> ntpd 183 root 5u IPv4 275 UDP localhost:ntp
> ntpd 183 root 6u IPv4 276 UDP 192.168.1.149:ntp
> inetd 4603 root 4u IPv4 26225 UDP *:amanda
> inetd 4603 root 5u IPv4 26226 TCP *:amandaidx (LISTEN)
> inetd 4603 root 6u IPv4 26227 TCP *:amidxtape (LISTEN)
> proftpd 4627 root 0u IPv4 26367 TCP *:ftp (LISTEN)
> exim 4653 root 0u IPv4 26384 TCP localhost:smtp (LISTEN)
> sshd 9013 root 3u IPv4 37451 TCP *:ssh (LISTEN)
> sshd 9022 root 4u IPv4 37477 TCP
> redstone.somewhere.com:ssh->192.168.1.185:4053 (ESTABLISHED)
>
> --
> Chris Lewis
> shadow@digitalnirvana.com
> ----------------------------------------
> If it compiles, it is good, if it boots up it is perfect.
> - Linus Torvalds
> ----------------------------------------
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
I have noticed that lsof will return different results for root than
unpriv users. I have not seen this behavior with netstat.
George