SSH change port to 2021
Hi , ive installed ubuntu and doing some security stuff.
non root- done
ssh key - done
fail2ban - done
now im stuck at changing the port.
these are my steps.
sudo nano /etc/ssh/sshd_config , edited the port >
reboot server.ssh -p 2021 [email protected]>
i receive error : ssh: connect to host myip port 2021: Connection refused
strange part is that i check the status it shows port 2021 active
[email protected]:~$ sudo netstat -tulpn |grep sshd>
tcp 0 0 0.0.0.0:2021 0.0.0.0:* LISTEN 1013/sshd: /usr/sbi
tcp6 0 0 :::2021 :::* LISTEN 1013/sshd: /usr/sbi>
so i open the firewall
sudo iptables -A INPUT -p tcp --dport 2021 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --dport 2021 -m state --state ESTABLISHED -j ACCEPT>
still cant go in. what am i doing wrong .?
4 Replies
Did you restart the firewall?
https://www.teclues.com/2020/03/start-stop-or-enable-disable-firewall-service-in-linux.html
Also, don't forget to close port 22.
-- sw
this is my ufw status
[email protected]:~# ufw status
Status: active
To Action From
-- ------ ----
2021 ALLOW Anywhere
2021 (v6) ALLOW Anywhere (v6)