Running multiple copies of openssh-server (sshd) on Ubuntu

Posted by cecilkorik on Server Fault See other posts from Server Fault or by cecilkorik
Published on 2011-03-08T15:33:30Z Indexed on 2011/03/08 16:12 UTC
Read the original article Hit count: 248

Filed under:
|

I may be attacking this problem the wrong way, if so let me know.

I have a server which is available through SSH from both the public internet and the local LAN. I would like to have two very different security policies for each, by running two copies of sshd with two different sshd_config files each on a different port.

Some of the things I'd like to change is to allow password or public-key authentication on the LAN, but public-key only from the internet. All (real) users could login from the LAN side, but only certain authorized users would be individually whitelisted to login through the internet.

As far as I can tell this requires having two different SSH daemons running on different ports with different sshd_configs. I am fine with the different ports part, I can easily forward port 22 to any port I want through my firewall.

So my question is what is the best way to actually START the second sshd under Ubuntu 10.04 LTS. Is there a recommended way to do something like this? Surely I am not the first person with this sort of need.

I have a bit of experience with upstart, and I can manually hack the second sshd into /etc/init/ssh.conf I suppose but I'm not sure if that will get overwritten by the package. However I do it, It's important to ensure both sshd processes always get restarted after any automatic or manual upgrade of the openssh-server package.

Thanks in advance.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about ssh