How to change SSH port (sshd) in Linux to increase VPS security
4 Attachment(s)
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. Attachment 2254 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... Attachment 2251 ... let's install it. In Ubuntu or Debian, you'll type apt-get install nano. For CentOS/RHEL, you'll type yum install nano. Attachment 2252 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. Attachment 2253 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. :) __________________
|
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.