2.7 Trouver le processus en écoute sur un port
Aller à la navigation
Aller à la recherche
# netstat -lapute Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name tcp 0 0 *:exec *:* LISTEN root 8868 3133/xinetd tcp 0 0 *:login *:* LISTEN root 8869 3133/xinetd tcp 0 0 *:shell *:* LISTEN root 8870 3133/xinetd tcp 0 0 *:mysql *:* LISTEN mysql 14140 5297/mysqld tcp 0 0 *:sunrpc *:* LISTEN root 7507 2638/portmap tcp 0 0 *:www-http *:* LISTEN root 596057639 1357/httpd2 tcp 0 0 localhost:novell-zen *:* LISTEN root 7820 2817/zmd tcp 0 0 *:33619 *:* LISTEN root 7570 - tcp 0 0 *:ftp *:* LISTEN root 7970 2912/vsftpd tcp 0 0 *:ssh *:* LISTEN root 9287 3341/sshd tcp 0 0 *:bpcd *:* LISTEN root 8866 3133/xinetd tcp 0 0 *:ipp *:* LISTEN root 9129 2771/cupsd tcp 0 0 *:vopied *:* LISTEN root 8872 3133/xinetd tcp 0 0 *:bpjava-msvc *:* LISTEN root 8867 3133/xinetd tcp 0 0 *:vnetd *:* LISTEN root 8871 3133/xinetd tcp 0 0 $SERVEUR:1006 $SERVEUR:nfs ESTABLISHED root 712106166 - tcp 0 97617 $SERVEUR:www-http $SERVEUR:55629 FIN_WAIT1 root 0 - tcp 0 0 $SERVEUR:808 $SERVEUR:nfs ESTABLISHED root 713152347 - tcp 0 1804 $SERVEUR:ssh $SERVEUR:49699 ESTABLISHED root 713152576 17293/sshd: $USER tcp 0 118889 $SERVEUR:www-http $SERVEUR:63806 FIN_WAIT1 root 0 - tcp 0 0 $SERVEUR:35099 $SERVEUR:mysql ESTABLISHED nobody 713131449 6574/httpd2 tcp 0 0 $SERVEUR:35082 $SERVEUR:mysql ESTABLISHED nobody 713124588 5921/httpd2
Ou
# lsof -i:${PORT}
# lsof -i:22 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME sshd 4907 root 3u IPv4 16218 TCP *:ssh (LISTEN)
Ou
# fuser -v -n tcp 22 USER PID ACCESS COMMAND 22/tcp: root 18126 F.... sshd
Ou
# fuser -va 21/tcp Cannot stat file /proc/3290/fd/5: No such file or directory
USER PID ACCESS COMMAND 21/tcp: root 3322 F.... vsftpd
ou
# ss State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 312 10.68.88.8:ssh 10.176.47.73:59891 ESTAB 0 0 127.0.0.1:56135 127.0.0.1:36935 ESTAB 0 0 127.0.0.1:56130 127.0.0.1:36935 ESTAB 0 0 127.0.0.1:36935 127.0.0.1:56130 ESTAB 0 0 127.0.0.1:36935 127.0.0.1:56135 ESTAB 0 0 10.68.88.8:ssh 10.176.47.4:64198 ESTAB 0 0 10.68.88.8:43832 10.68.161.2:ldap ESTAB 0 0 10.68.88.8:43831 10.68.161.2:ldap ESTAB 0 0 10.68.88.8:43831 10.68.161.2:ldap
# ss -ap State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 0 *:exec *:* users:(("xinetd",4644,9)) LISTEN 0 0 *:login *:* users:(("xinetd",4644,10)) LISTEN 0 0 *:shell *:* users:(("xinetd",4644,11)) LISTEN 0 0 127.0.0.1:36935 *:* # ss -l -t State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 5 127.0.1.1:domain *:* LISTEN 0 128 *:ssh *:* LISTEN 0 128 127.0.0.1:ipp *:* LISTEN 0 50 *:microsoft-ds *:* LISTEN 0 50 *:netbios-ssn *:* LISTEN 0 128 :::ssh :::* LISTEN 0 128 ::1:ipp :::* LISTEN 0 50 :::microsoft-ds :::* LISTEN 0 50 :::netbios-ssn :::*