Two independent SSHD processes?

Rick Stevens ricks at alldigital.com
Wed Jan 21 00:32:40 UTC 2015


On 01/20/2015 04:20 PM, CLOSE Dave wrote:
> I'd like to run two SSH daemons on the same machine. They will listen on
> different ports and have other differences in their configuration. I
> want these two daemons to be independent of each other: either can run
> while the other is stopped. I need to do this for recent (systemd)
> machines and for older ones (SysV).
>
> I'm finding that, although the SSH daemon records its PID in a file,
> that file is not configurable. Consequently, it seems that stopping one
> of the daemons causes the other to also stop. Same for starting one.
>
> Here is the procedure I'm using to setup the second daemon on SysV. (The
> first one is the standard daemon normally running. I haven't tried yet
> on systemd.)
>
> cd /usr/sbin; ln -s sshd xsshd
> cd /etc/pam.d; ln -s sshd xsshd
> cp /etc/rc.d/init.d/sshd /etc/rc.d/init.d/xsshd
> # edit /etc/rc.d/init.d/xsshd to reference a different config file
> # and the new program name, xsshd
> chkconfig --add xsshd
>
> I realize that I might be able to workaround these difficulties, or some
> of them, by revising the standard system control files. I'd like to
> avoid doing that and just fit within the Fedora framework. Is that
> likely to be possible?

You need two /etc/sshd/sshd_config* files, one for each sshd server 
process. You can specify the PID file using the directive:

	PidFile /path/to/desired/PID/file

in the appropriate config file. You'll need to start the sshd processes
by specifying which config file you want, e.g:

	sshd -f /etc/sshd/sshd_config-1
	sshd -f /etc/sshd/sshd_config-2

----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-           What is a "free" gift?  Aren't all gifts free?           -
----------------------------------------------------------------------


More information about the users mailing list