Help - Search - Members - Calendar
Full Version: SSH on a different port?
The Planet Forums > System Administration > Other
brad
Apparently my employer now blocks traffic on port 22 (though 21 is still open, go figure...). Is there a way to make SSH listen on an additional port?

Running RHE3/CPanel
sean1121
You can change the port ssh listens on in the config file /etc/ssh/sshd_config.

Change:
CODE
Port 22

to whatever port you want it to listen on.

Or you could DNAT the connection with iptables:
CODE
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5555 -j DNAT --to 127.0.0.1:22

This would forward ssh connections on port 5555 to port 22 on the localhost.
brad
Hmmm...I think I may have mucked it up lol.

Being afraid that some CPanel scripting might use SSH, I opted to try the DNAT option, Sean. After I ran the command though...I can't get in on either port 22 or 5555.

The connection times out. Have I locked myself out now somehow?
sean1121
Do you have a firewall already setup? Unless you put that line in the startup script it won't be reapplied on reboot so that could get you back in.
Does your employer block port 5555 as well? I can test it if needed if you want to post or PM me the ip.
brad
Not yet...I was going to wait until I had time to read up on APF a bit first (or hire Acunett to do it for me).

I just rebooted it for now...I forgot that I have access to one of our DMZs so this isn't as big an issue as I thought originally icon_smile.gif

I appreciate the help...and the quick replies Sean icon_wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.