deadlock

Well-Known Member
May 12, 2002
58
0
306
When I try to run SSH on any other port than 22 (for security reasons), I can connect and everything works fine for a little while, but then after a couple of minutes the connection drops. I've tried various different random port numbers but it's always the same, I can't stay connected. On port 22 I can stay connected for ages without any problem but it keeps getting attacked so I want to change it, but I also want to be able to stay connected :( Has anyone else had this problem or can suggest a solution?
 

deadlock

Well-Known Member
May 12, 2002
58
0
306
Yes that's exactly what I do to change port. Like I said, I have no problem connecting on other ports but my problem is *STAYING* connected for any length of time.
 

Anishts

Active Member
Oct 6, 2005
37
0
156
Hi

If connection timed out error is coming try this.

in /etc/ssh/ssh_config put this line..

ServerAliveInterval 240
 

deadlock

Well-Known Member
May 12, 2002
58
0
306
LoginGraceTime was already commented; ServerAliveInterval 240 broke the server :(

I had another idea, I thought maybe the firewall on my PC was the culprit so I tried disabling it but it made no difference.

Any other ideas?
 

deadlock

Well-Known Member
May 12, 2002
58
0
306
The connection drops when I'm right in the middle of doing something so that's not it, thanks anyway.
 

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
By default SSH runs on port 22 (mine is not on port 22), so the fact that it drops the connection on all other ports after a short while could either mean that other programs are trying to use those ports, or your'e firewall was set to close suspicious ports. Check the firewall rules, making sure the port in question is not being blocked, and that no other programs are trying to use the port you want to use. Try using a port in the high ranges, say 4000 or something
 

randomuser

Well-Known Member
Jun 25, 2005
146
0
166
1. connect to sshd on the alternate port
2. from the computer you connected from, start tcpdump or windump and log the complete packets (like: tcpdump -Xnvvs 1500 >> out)
3. when you get disconnected, ctrl+c tcpdump/windump
4. check to see where the disconnect came from

That would be a good start.

Also, is there an IPS anywhere in the mix between you and the server you're connecting to?
 

Anishts

Active Member
Oct 6, 2005
37
0
156
Hi

Sorry I forgot to tell one thing you have to add this in client machine

in /etc/ssh/ssh_config put this line..

ServerAliveInterval 240
 

sierrablue

Active Member
Aug 30, 2005
33
3
158
cPanel Access Level
Root Administrator
When I try to run SSH on any other port than 22 (for security reasons), I can connect and everything works fine for a little while, but then after a couple of minutes the connection drops. I've tried various different random port numbers but it's always the same, I can't stay connected. On port 22 I can stay connected for ages without any problem but it keeps getting attacked so I want to change it, but I also want to be able to stay connected :( Has anyone else had this problem or can suggest a solution?
I had similar problem. SIM (system integrity monitor) was checking if sshd was up and constantly restarting sshd.

Editing SSH port in /usr/local/sim/conf.sim solved my problem.
 

eth00

Well-Known Member
PartnerNOC
Mar 30, 2003
721
1
168
NC
cPanel Access Level
Root Administrator
I had similar problem. SIM (system integrity monitor) was checking if sshd was up and constantly restarting sshd.

Editing SSH port in /usr/local/sim/conf.sim solved my problem.
To make sure it is that you can look at the sim.log, it should be reporting it in the log when it is restarted.