Topic: Howto: Change Default SSH Port For Prevent Brute Force Attacks
If you activated sshd daemon in FreeBSD, you should change default ssh port, because a lot of hackers will brute force your ssh login and password. Here is a part of my log before I changed default port:
Apr 28 00:03:10 host sshd: Invalid user postgres from 22.214.171.124 Apr 28 00:19:03 host sshd: Invalid user info from 126.96.36.199 Apr 28 00:31:00 host sshd: Invalid user info1 from 188.8.131.52 Apr 28 00:42:56 host sshd: Invalid user info from 184.108.40.206 Apr 28 00:54:53 host sshd: Invalid user media from 220.127.116.11 Apr 28 01:06:48 host sshd: Invalid user user from 18.104.22.168 Apr 28 01:18:44 host sshd: Invalid user user2 from 22.214.171.124 Apr 28 01:30:41 host sshd: Invalid user user3 from 126.96.36.199
Now, open your rc.conf:
# ee /etc/rc.conf
After string sshd_enable="YES", type:
You can type 2244, 4444 or any other non system port.
Note: for save config file and exit from ee press ESC-a-a.
Then reboot your server or run command:
# service sshd reload
Now you can connect to your server with command:
# ssh email@example.com -p 4422
If you're using PuTTy on Windows, you can specify the port number in the profile for you connection and then re-save the profile using the new port.