Saturday, June 27, 2009

Change SSH Port

If you have two or more computers behind a NAT (i.e., router) and you want to access both machines, you need to change the SSH port on at least one of them. To do so, as root, edit /etc/ssh/sshd_config. Add a line that reads "Port PORT_NUMBER". The relevant part of my file looks like this:

Port 2200
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::


You will need to either restart the SSH daemon (or reboot) before the change will take effect. And of course, you'll need to adjust the firewall on your computer to allow the new port to pass through, as well adjust your NAT.

No comments:

Post a Comment