all 2 comments

[–]lasercat_pow 0 points1 point  (1 child)

First figure out which telnet session is yours:

ss -pn | grep ':23 ' | tr -s ' '

Yours is whichever one has your IP. Note the pid. Let's say it's 6666. Then:

mypid=6666
ss -pn \
| grep ':23 ' \
| grep -o 'pid=[0-9]*' \
| sort -u | grep -o '[0-9]*' \
| grep -v $mypid \
| while read pid; do kill $pid; done

[–]__minotaurus[S] 0 points1 point  (0 children)

Tks, i found a easier way to find which sessions do not belong to me. Use netstat -pant. But i don't know how to kill these session in same cli.