Thread: Securing SSH
View Single Post
  #1 (permalink)  
Old 19-04-2008, 18:41
WelshTom's Avatar
WelshTom WelshTom is offline
Moderator
 
Join Date: May 2007
Location: Newport, Wales
Posts: 786
Send a message via AIM to WelshTom Send a message via MSN to WelshTom Send a message via Yahoo to WelshTom
Default Securing SSH

Securing SSH is vitally important. Here are a few simple steps which will help you secure SSH on your server.

The first thing you should do is change the port that SSH listens on. This will help prevent automated-hacking tools from trying to brute force their way into your server.

To do this, open your SSH client (Putty is recommended).

Login to your server.

At the command line, you need to go to /etc/ssh

To do this, type "cd /etc/ssh" and hit enter.

You then need to edit the SSH config file. To do this, type "vi sshd_config" at the command prompt.

You will then be presented with the SSH config, please be careful when editing this file - as if you break it, SSH can fail and you will not be able to access your server.

You need to look for the line which should look like the following:

Quote:
Port 22
To change the SSH port, simply hit the insert key on your keyboard, and change 22 to a port of your choice. Please make sure that you open the port in any firewall modules which you have installed, and that the port isn't already in use by some other application.

When you have changed the port number, simple hit escape on your keyboard, and then type ":wq" and hit enter. This will save the file and return you to the console.

When this is done, you'll need to restart SSH as follows:

"service sshd restart"

When I get a bit more time, I'll explain on how to disable Password Authentication, to make your server more secure.
__________________
Thomas Williams
Founder of TWR Web Design
http://www.twrwebdesign.co.uk/
Reply With Quote