TransWikia.com

what are the options to close manual the port correctly or release the port on rhel machines?

Unix & Linux Asked on November 19, 2021

we have redhat 7.5 server

we are suspect that port 50070 not closed correctly by the service , ( we check by netstat and PID not found ) but from the log we can see that port is in use

so we try to do the following for example ,

ss --kill state listening src :50070
ss: unrecognized option '--kill'
Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
   -h, --help          this message
   -V, --version       output version information
   -n, --numeric       don't resolve service names
   -r, --resolve       resolve host names
   -a, --all           display all sockets
   -l, --listening     display listening sockets
   -o, --options       show timer information
   -e, --extended      show detailed socket information
   -m, --memory        show socket memory usage
   -p, --processes     show process using socket
   -i, --info          show internal TCP information
   -s, --summary       show socket usage summary
   -b, --bpf           show bpf filter socket information
   -Z, --context       display process SELinux security contexts
   -z, --contexts      display process and socket SELinux security contexts
   -N, --net           switch to the specified network namespace name

   -4, --ipv4          display only IP version 4 sockets
   -6, --ipv6          display only IP version 6 sockets
   -0, --packet        display PACKET sockets
   -t, --tcp           display only TCP sockets
   -u, --udp           display only UDP sockets
   -d, --dccp          display only DCCP sockets
   -w, --raw           display only RAW sockets
   -x, --unix          display only Unix domain sockets
   -f, --family=FAMILY display sockets of type FAMILY

   -A, --query=QUERY, --socket=QUERY
       QUERY := {all|inet|tcp|udp|raw|unix|unix_dgram|unix_stream|unix_seqpacket|packet|netlink}[,QUERY]

but ss not include the kill flag

what are the option to close the port correctly or release the port on rhel machines ?

One Answer

You don't kill the port, you kill the daemon/service that opened it. You can block traffic to a port using firewalld or iptables.

First of all, try to telnet localhost 50070. Are you able to connect?

If yes, execute this command:

sudo ss -tulp
(sudo is not needed if you're executing the command as root. -p parameter shows the processes and needs elevated rights)

Locate the line mentioning port 50070. Use grep if you have many listening ports. The last column will show you the name and PID that has opened the port. Kill this and it should close.

Answered by Krackout on November 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP