using VPS and Ubuntu (latest version). When I changed ssh port by going into sudo nano /etc/ssh/sshd_config it did not work. When checked via sudo lsof -i -n -P | grep LISTEN, it shows it's still listening to port 22. Then when I tried to login again, console showed SSH connection lost.
Then found this thread: SSH default port not changing (Ubuntu 22.10) and I put the commands as:
mkdir -p /etc/systemd/system/ssh.socket.d
cat >/etc/systemd/system/ssh.socket.d/listen.conf <<EOF
[Socket]
ListenStream=
ListenStream=46876
EOF
sudo systemctl daemon-reload
sudo systemctl restart ssh
When checking systemctl status ssh, it shows failed. Why there is ListenStream two times?
Been at this for too long. Can someone please help me with the commands to change the port?
Thank you.