You can find the SSH configuration file at
To change specific parameters within sshd_config:
To change the SSH port to 567, you will need to make the line appear like this:
After you are finished configuring SSH, you will need to add the port to iptables as well as your installed firewall. To update iptables, please enter the following in SSH:
After making the necessary changes to iptables and your computer's firewall, you will need to restart the SSH daemon. You can do so by issuing the following command:
Log out of your server and log in again using the proper username, IP address and port number you specified in sshd_config.
/etc/ssh/sshd_config
.
When updating SSH ports, be sure to add the port number to the firewall; otherwise, users will be locked out of the server.
Change Specific Parameters within sshd_config
To change specific parameters within sshd_config:
- Log into your server as the root user.
- Uncomment the desired line by removing the number-sign (#) and changing the value for the line.
#Port 22
To change the SSH port to 567, you will need to make the line appear like this:
Port 567
Update IPTables and Firewall
After you are finished configuring SSH, you will need to add the port to iptables as well as your installed firewall. To update iptables, please enter the following in SSH:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 567 -j ACCEPT
When using the command above, be sure to substitute 567 with the actual port number you are adding.
Reset SSH Daemon
After making the necessary changes to iptables and your computer's firewall, you will need to restart the SSH daemon. You can do so by issuing the following command:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 567 -j ACCEPT
Log out of your server and log in again using the proper username, IP address and port number you specified in sshd_config.