LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Configuring SSH to listen on two different ports at once (https://www.linuxquestions.org/questions/linux-software-2/configuring-ssh-to-listen-on-two-different-ports-at-once-386207/)

james penguin 11-24-2005 03:32 PM

Configuring SSH to listen on two different ports at once
 
Hi there, ok here's the dealio.

I am running a webserver/router on Slackware 10.2 Now at school I can't ssh in because the firewall drops outbound packets on port 22. So what I'd like to do is run SSH on both ports 22 and 23 (or any unfiltered port for that matter) Now the problem is I'm not sure how to write that out in the confg files, and I don't want to drag my 100lb CRT keyboard and mouse over to it just to do some config file trial and error.

So does anyone know how to write (if it even is possible) in the sshd_config file to listen on 2 ports?

Would it be something like
Port 22 , 23 or maybe Port 22 23 or Port 22,23

I really don't know and I don't want to risk crapping out ssh and having to drag the server around just to fix it.

Also since I use it as a router, would it just be easier to set an iptables rule to forward all packets recieved on port 23 to 127.0.0.1:22 and if so would the rule have to look something like this?

Code:

iptables -p tcp -t nat -A PREROUTING -i ppp0 --dport 22 -j DNAT --to-destinatination 127.0.0.1:23
iptables -A FORWARD -i ppp0 -p tcp--dport 23 -j ACCEPT

Thanks in advance.

Matir 11-24-2005 05:00 PM

I recall reading somewhere that it would be:
Code:

Port 22
Port 23

. I could be wrong though. :)

btmiller 11-24-2005 05:08 PM

You can also start up two instances of sshd, each with different config files that tell them to listen on different ports. Port 23 may be filtered since telnet uses it, so you may want to try something higher.

Matir 11-24-2005 05:20 PM

Per the OpenSSH sshd_config manpage,
Quote:

Port Specifies the port number that sshd listens on. The default is
22. Multiple options of this type are permitted. See also
ListenAddress.

james penguin 11-24-2005 09:08 PM

yup its
port 22
port 23

thanks homes


All times are GMT -5. The time now is 12:21 PM.