Changing the port away from the default 22 is one way to add security-by-obscurity to your VPS or dedicated web server. It's extremely simple, and you only need to change one line in the sshd config file, using your Linux text editor (like nano, vi, etc).
Step 1:Log into SSH with Putty.
sshport1-putty.jpg
Step 2: See if a decent text editor is installed, such as nano.
Type
nano at the shell prompt. If nano opens, great! Press CTRL+X and close it again. But if nano is not installed...
You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community. |
... let's install it. In Ubuntu or Debian, you'll type
apt-get install nano. For CentOS/RHEL, you'll type
yum install nano.
sshport2-nano.jpg
Step 3: Edit the sshd config, select new port.
Hackers and script kiddies like to look for the default port 22, and the poor alternative choice 2222, so pick something else. For example, 2255.
IMPORTANT: Pick a port not used by anything else! Find a port not listed here:
http://en.wikipedia.org/wiki/List_of...P_port_numbers
At the shell prompt, type
nano /etc/ssh/sshd_config and you'll find
Port 22 near the top of the configuration file. Using your keyboard arrows (not mouse), move down to the line, and delete/backspace the old number, and type in a new one using the number row on your keyboard (not the number keypad).
Press CTRL+X to save. Press Y to confirm. Press ENTER to overwrite the old config file.
You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community. |
Step 4: Config firewall (if present)
If you have a firewall installed, be sure to close off port 22, and add the new port. Restart the firewall service after Step 5. This quickie guide does not cover firewall usage or maintenance, because there are quite a few choices.
CSF/LFD is my suggestion.
Step 5: Restart SSH.
Type
service sshd restart into shell.
Done.
__________________
Need a good web host? — Read our 2018 Review of the Best Web Hosts
Quite often, problems with web sites are caused by having a rotten web host. Worse yet, many hosts try to blame you (the customer) for the problems! So dump that lousy company. Say goodbye to slow sites, unresponsive support techs, and downtime. Find yourself a new host today. Whether you need shared, reseller, VPS, semi-dedicated, cloud, or dedicated hosting, something on our list should be a good upgrade for you.
|