Register

Closed Thread

Junior Member

Join Date: Jul 2005
Posts: 21
 
11-07-2005, 11:53 AM
Default Change the SSH port

Hi all
I have a VPS with redHat 9 and want to know if is possible to change the SSH port.
I installed BDF and detects over 3 or 4 Brute force attacks all days, some of they very intensive.

Tnx
MrTeck is offline
Junior Member

Join Date: Apr 2005
Posts: 12
 
11-07-2005, 09:46 PM
Default Running SSHD on an alternate port and connecting to the service

Hey MrTeck,

Changing the port sshd listens on is a simple process; it's just a matter of updating your sshd_config file and then reloading the new configuration.

Use the procedure below to change the port that sshd is listening on to 2995:



Warning: Incorrectly following this procedure may render your server unreachable through SSH. If by following this procedure you are locked out of your server, and you require Spry Support to reset SSHD, you may incur a support fee for resetting SSH on your server.



1. From your terminal session, edit /etc/ssh/sshd_config

Code:
bash-2.05b# vi /etc/ssh/sshd_config
2. Look for the following line:

Code:
#Port 22
3. Change the line so it looks like this:

Code:
Port 2995
4. Save and close the file

5. Load the new configuration by using the RedHat service command

Code:
bash-2.05b# service sshd reload
Note: you may immediately lose connectivity to your server on the open ssh session you are currently running.


6. Test the connection

Code:
(tres@Ishmael)(~/Desktop) $ ssh username@myhostnaname.com -p 2995
Take note of the -p 2995 flag used when connecting to the server. If you are using OS X or a Linux desktop system like Mandriva or Ubuntu, you'll need to specify the port number when connecting. 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.

Last edited by tres; 11-07-2005 at 10:53 PM.
tres is offline
Junior Member

Join Date: Jul 2005
Posts: 21
 
11-09-2005, 05:05 AM
Default

Well, I was trying this, but no works :S
My /etc/ssh/sshd_config
Code:
Port 8888
Protocol 2
#ListenAddress 0.0.0.0
#ListenAddress ::
Quote:
[root@server root]# service sshd reload
sshd: unrecognized service
I restart SSH in VPP but still on port 22 :/
MrTeck is offline
Junior Member

Join Date: Apr 2005
Posts: 12
 
11-12-2005, 04:12 PM
Default Restarting SSH service

A reboot will take care of changing the port if just restarting the service is not working.

Tres
tres is offline
Junior Member

Join Date: Jul 2005
Posts: 21
 
11-15-2005, 12:47 AM
Default

Today...
Quote:
The remote system 84.244.4.36 was found to have exceeded acceptable login failures on server.com; there was 374 events to the service sshd.
As such the attacking host has been banned from further accessing this system. For the integrity of your host you should investigate this event as soon as possible.

Executed ban command:
/sbin/iptables -I INPUT -p tcp -s 84.244.4.36 -j DROP


After reboot still at port 22.
MrTeck is offline
Junior Member

Join Date: Jul 2005
Posts: 21
 
11-15-2005, 12:51 AM
Default

Well, finally found the solution.

pico /etc/xinetd.d/sshd
Code:
service ssh
{
        disable = no
        socket_type             = stream
        type                    = UNLISTED
        port                    = 22
        protocol                = tcp
        wait                    = no
        user                    = root
        server                  = /usr/sbin/sshd
        server_args             = -i
}
Change "port = 22" for the new port and restart. Now works fine.

Tnx for your help tres
MrTeck is offline
Junior Member

Join Date: Jul 2005
Posts: 21
 
11-16-2005, 12:30 AM
Default

First day without a brute force attack
MrTeck is offline
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 02:17 AM. Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 VBulletin Skin by ForumMonkeys.