If you have a Linux-based server and want to change your SSH Port for security purposes, the way to do this is very simple
Connect to your server immediately and change your ssh port securely by running the command below.
All you need to do to change your SSH Port is to connect to your server and apply the command below.
wget https://teklan.com.tr/vps/ssh-degistir
chmod +x ssh-degistir
sh ssh-degistir
If you want to do this manually yourself;
After connecting to your server with SSH;
After typing the nano /etc/ssh/ssh-config command, when you find the # Port section on the screen that opens, if there is # at the beginning of the line, remove it and write any port you want instead of port 22, save it with ctrl + x and exit.
Then you need to add your new SSH Port to the firewall and restart the ssh server.
For that, you should apply the commands below.
semanage port -a -t ssh_port_t -p tcp your-new-ssh-port
sudo firewall-cmd --permanent --zone=public --add-port=YOUR-NEW-SSH-PORT/tcp
sudo firewall-cmd --reload
/etc/init.d/sshd restart
systemctl restart sshd
And finally, you can check if your SSH Port has changed with the following command.
sudo netstat -an | grep your-new-ssh-port
See you in a new article, stay healthy and happy.