Quantcast How to change SSH port (sshd) in Linux to increase VPS security - digitalFAQ.com Support Forum
Go Back   digitalFAQ.com Support Forum > Digital Publishing / Web Design > Web/Print Publishing Technology

Reply
LinkBack Thread Tools
  #1  
01-17-2012, 07:06 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff / Freelance Video Restorer
 
Join Date: May 2005
Posts: 2,317
Thanks: 108
Thanked 172 Times in 150 Posts
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.

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 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.

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 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 ssh restart into shell. Done.

__________________

Need a good host?
Find one here --> List of the Best Web Hosts in 2012 - Shared, reseller and VPS hosting


__________________
- Did my advice help you? Then become a Premium Member or make a donation.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.

Reply With Quote


Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove unnecessary port access with CSF/LFD firewall in cPanel kpmedia Web/Print Publishing Technology 0 01-12-2012 02:23 AM
How to change SMTP port: Exim, DirectAdmin, SquirrelMail and Roundcube kpmedia Web/Print Publishing Technology 0 01-10-2012 01:43 AM
Cannot unzip network file: 'Your current security settings do not allow this action' kpmedia Computers 0 09-08-2011 02:29 AM
Widen [code] box in vBulletin forum, change style to increase width kpmedia Web/Print Publishing Technology 0 07-25-2011 07:14 AM
Buy.com deals - Dazzle video capture, anti-virus/security, PaintShop, laptop/desktop admin Computer Hardware, Software - Coupons, Sales and Deals 0 10-30-2009 04:47 AM

Thread Tools



 
All times are GMT -5. The time now is 06:28 PM  —  vBulletin Copyright © 2011 Jelsoft Enterprises Ltd  —  SEO by vBSEO