Discussion:
Internet Serverprozesse PID ermitteln?
Add Reply
Ulli Horlacher
2025-02-20 13:15:39 UTC
Antworten
Permalink
root kann Internet Serverprozesse ermitteln:

***@fex:~# lsof -i -P | grep ^sshd.*framstag.*LISTEN
sshd 4328 framstag 7u IPv4 40145 0t0 TCP localhost:6010 (LISTEN)
sshd 6036 framstag 7u IPv4 47950 0t0 TCP localhost:2201 (LISTEN)

Der User dem der Prozess gehoert, kann das nicht:

***@fex:~: lsof -i -P | grep ^sshd.*framstag.*LISTEN
(kein Output)

Warum nicht?
Welche Alternativen gibts?
Im ps-Output erscheint die Portnummer 2201 nicht

Hintergrund:
Der Prozess mit localhost:2201 haengt und ich will als User die PID dazu
ermitteln um den Prozess abzuschiessen.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: ***@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/
Ralph Aichinger
2025-02-20 13:32:14 UTC
Antworten
Permalink
Post by Ulli Horlacher
Welche Alternativen gibts?
netstat -tulpen oder ss -lp?

***@pi:~$ ss -lp |grep ssh
u_str LISTEN 0 4096 /run/user/1000/gnupg/S.gpg-agent.ssh 66396 * 0 users:(("systemd",pid=2438,fd=29))
tcp LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
tcp LISTEN 0 128 [::]:ssh [::]:*

/ralph
Ulli Horlacher
2025-02-20 14:36:50 UTC
Antworten
Permalink
Post by Ralph Aichinger
Post by Ulli Horlacher
Welche Alternativen gibts?
netstat -tulpen oder ss -lp?
Beides funktioniert und ich hatte das auch mal gewusst!
memory overflow :-}

Thanks.

Interne Notiz: mehr aufschreiben!
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: ***@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: https://www.tik.uni-stuttgart.de/
Tim Ritberg
2025-02-20 14:28:51 UTC
Antworten
Permalink
Post by Ulli Horlacher
sshd 4328 framstag 7u IPv4 40145 0t0 TCP localhost:6010 (LISTEN)
sshd 6036 framstag 7u IPv4 47950 0t0 TCP localhost:2201 (LISTEN)
(kein Output)
Warum nicht?
Hm:
#netstat -tpnl | grep 1111

tcp 0 0 0.0.0.0:1111 0.0.0.0:*
LISTEN 766058/nc

Tim
Peter J. Holzer
2025-02-20 17:58:56 UTC
Antworten
Permalink
Post by Ulli Horlacher
sshd 4328 framstag 7u IPv4 40145 0t0 TCP localhost:6010 (LISTEN)
sshd 6036 framstag 7u IPv4 47950 0t0 TCP localhost:2201 (LISTEN)
(kein Output)
So allgemein stimmt das nicht:

% lsof -i -P | grep LISTEN
flask 1041926 hjp 5u IPv4 31498282 0t0 TCP localhost:5000 (LISTEN)
python3 1041991 hjp 5u IPv4 31498282 0t0 TCP localhost:5000 (LISTEN)
python3 1041991 hjp 6u IPv4 31498282 0t0 TCP localhost:5000 (LISTEN)

Bei sshd funktioniert das vermutlich nicht, weil /proc/$PID/fd nur für
Root lesbar ist. Aber wie sshd das zustandebringt, weiß ich auch nicht.

hp

Loading...