Ubuntu - change SSH port

Moki Lv6
1
2
3
4
5
sed -i 's/#Port.*/Port 2222/g' /etc/ssh/sshd_config && \
sed -i 's/ListenStream.*/ListenStream=2222/g' /etc/systemd/system/ssh.socket.d/listen.conf && \
systemctl daemon-reload && \
systemctl restart ssh.socket && \
systemctl restart ssh
On this page
Ubuntu - change SSH port