linux-logo-300x300

By default, SSH listens on both IPv4 and IPv6, if you don’t connect using IPv6 then you can disable it entirely from listening.

Example:

[email protected]:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2241/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2206/exim4
tcp6 0 0 :::22 :::* LISTEN 2241/sshd

Edit your SSH config file /etc/ssh/sshd_config

vi /etc/ssh/sshd_config

Uncomment out the following line:

#ListenAddress 0.0.0.0

Restart SSH daemon

/etc/init.d/ssh restart

Rerun netstat to check it isn’t listening

[email protected]:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2292/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2206/exim4

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.