View Full Version : [ubuntu] Is it possible to have more than one SSH port?

July 14th, 2009, 02:41 PM

I know port 22 is used for SSH. However, let's assume I'm on a network that blocks port 22, but I still need to SSH into my server.

Is it possible to configure my ubuntu server to accept SSH connections on 22 AND 443? (would this break SSL? If so, are there other ports which have have a high probability of not being blocked, say on a college network...)

Basically, can I configure my server to listen on port 22 and a different port number? And how could I do this?

July 14th, 2009, 02:48 PM
Do you need port 22? it's pretty easy to have ssh listen on another port, I'm not sure you can have it listen on two different ports though. but if it's just a matter of port 22 being blocked you could just move to a different port.

July 14th, 2009, 02:54 PM
Look here:


July 14th, 2009, 02:57 PM
I'd be careful.

Not saying you're trying to do anything ignorant like I did but I almost became unemployed several years ago for pulling a trick like this.

Assuming this is your employer's network they're blocking port 22 for a reason. You may very well still get caught because the firewall will report an SSH protocol being used on a nonstandard port.

If you don't own the network maybe it'd be a good idea not to try to circumvent network security.

July 14th, 2009, 02:58 PM
That webpage doesn't help. Also it isn't my employers network. In fact is it nobody's network, purely theoretical. I just DONT want to be without my server just incase a friends networks, public access point, school, college decides to block port 22... when I'm in desperate need to access my server :)

I need both 22 and 443. Not just one.

It says plural... 'ports' here in SSHD_config:


I just need to know how to write it... eg. does it need to be 'port 22, 443' or 'port 22 443'

I cannot afford to be locked out of the server... so I cannot just try blindly :P

July 14th, 2009, 03:08 PM
you can have two "port lines, like:
Port 22
Port 443

but, as wizard1000 says, maybe there's a reason they're blocking port 22?

July 14th, 2009, 03:10 PM
you can have two "port lines, like:
Port 22
Port 443

but, as wizard1000 says, maybe there's a reason they're blocking port 22?
Yeah maybe. But I just want to be safe knowing I can access my server.

How can I 'reload' the file now, or can I just restart? Because it's still not accepting SSH connection on 443?

July 14th, 2009, 03:14 PM
sudo /etc/init.d/ssh restart

If you had taken time to read the page you could have figured it out.

July 14th, 2009, 04:01 PM
You could also probably set up an iptables rule to forward whatever port you want to port 22, although if you can just have ssh listen to both ports, I'd say that's a better way to go.

July 14th, 2009, 05:16 PM
thanks, it works :D

July 15th, 2009, 11:59 PM
posted in wrong thread