09-13-2017, 11:38 AM
Depending of what Linux version you are using
you can do a search on google
but if you are using Cent OS Linux, try following the below instructions
1: Login with the root user name and password
-su
2: Backup the ssh config file
-sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
3: Edit the ssh config file
-sudo vi /etc/ssh/sshd_config
4: press insert key to begin the edit of the file
5: scroll down to #Port 22 - and enter the port number you wish you use - make sure to remove # after editing
6: type: ":wq" to save the changes and press: "ENTER" to confirm
7: Next install the python config
-sudo yum -y install policycoreutils-python
8: reenter the new port is here
-sudo semanage port -a -t ssh_port_t -p tcp "ENTER THE TCP PORT HERE FROM STEP 5"
9: Next check the firewall
-sudo firewall-cmd --permanent --zone=public --add-port="ENTER THE TCP PORT HERE FROM STEP 5"/tcp
-sudo firewall-cmd --reload
10: now restart the SSH services
-sudo systemctl restart sshd.service
11: Now the new port has been configured -
ss -tnlp | grep ssh
12: if you would like to rollback the change from steps 1 - 10
IN THE CASE SSH ISNT WORKING ANYMORE
you may need to Reinstall the SSH services - USING THIS COMMAND
-yum -y install openssh-server openssh-clients
Hope this help and please provide me your feedback.
you can do a search on google
but if you are using Cent OS Linux, try following the below instructions
1: Login with the root user name and password
-su
2: Backup the ssh config file
-sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
3: Edit the ssh config file
-sudo vi /etc/ssh/sshd_config
4: press insert key to begin the edit of the file
5: scroll down to #Port 22 - and enter the port number you wish you use - make sure to remove # after editing
6: type: ":wq" to save the changes and press: "ENTER" to confirm
7: Next install the python config
-sudo yum -y install policycoreutils-python
8: reenter the new port is here
-sudo semanage port -a -t ssh_port_t -p tcp "ENTER THE TCP PORT HERE FROM STEP 5"
9: Next check the firewall
-sudo firewall-cmd --permanent --zone=public --add-port="ENTER THE TCP PORT HERE FROM STEP 5"/tcp
-sudo firewall-cmd --reload
10: now restart the SSH services
-sudo systemctl restart sshd.service
11: Now the new port has been configured -
ss -tnlp | grep ssh
12: if you would like to rollback the change from steps 1 - 10
IN THE CASE SSH ISNT WORKING ANYMORE
you may need to Reinstall the SSH services - USING THIS COMMAND
-yum -y install openssh-server openssh-clients
Hope this help and please provide me your feedback.