Linux/Security

CentOS 7 포트를 사용하는 데몬(프로세스)명 확인하기

Pydole 2019. 12. 11. 19:18

 

예를 들어 서버에서 631포트가 LISTEN 상태로 되어 있고, 어떤 데몬(프로세스)가 사용하고 있는지 확인

 

 


 

netstat 명령어로 포트와 사용하는 프로세스 확인

 

# netstat -tnlp | egrep ':631'
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1382/cupsd
tcp6       0      0 ::1:631                 :::*                    LISTEN      1382/cupsd

 

 

- cupsd : Common UNIX Printing System (프린터 서버)

 

 

 

 

 

 

pstree 명령어로 프로세스 상관관계 확인

(pstree가 설치되어 있지 않으면, yum -y install psmisc으로 설치)

 

# pstree


systemd─┬─ModemManager───2*[{ModemManager}]
        ├─NetworkManager───2*[{NetworkManager}]
        ├─crond
        ├─cupsd
        ├─2*[dbus-daemon───{dbus-daemon}]

 

 

 

 

 

서비스에 등록되어 있음을 확인

 

# systemctl status cups

 

 cups.service - CUPS Printing Service
   Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
   Active: active (running) since
 Main PID: 1382 (cupsd)
   CGroup: /system.slice/cups.service
           └─1382 /usr/sbin/cupsd -f