在debian 8(jessie)systemd上configuration多个sshd实例

我想在debian 8上运行两个sshd守护进程(使用openssh),一个用于pipe理,一个用于sftp。

这在debian 7中是相当容易的,但是使用systemd会更困难。

到目前为止,我已经创build了sshd_config_secondssh_config_second

我将如何为sshd_second.service创build一个服务文件并启动守护程序?

我看了一下sshd.service,但是没有引用sshd_config文件。 在哪里给守护进程这些configuration文件?

更新:

我从RHEL7开始就是这样成功的:

https://access.redhat.com/solutions/1166283

默认的Debian 8 systemd sshd单元在/lib/systemd/system/ssh.service ,非常简单。 所有你需要做的就像cp /lib/systemd/system/ssh.service /etc/systemd/system/ssh_sftp.service然后编辑你的文件是这样的。

 [Unit] Description=OpenBSD Secure Shell server After=network.target auditd.service ConditionPathExists=!/etc/ssh/sshd_not_to_be_run [Service] EnvironmentFile=-/etc/default/ssh ExecStart=/usr/sbin/sshd -D -f /etc/ssh/sshd_sftp_config $SSHD_OPTS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target Alias=ssh_sftp_d.service 

创build该文件后,启用并启动它。 systemctl enable ssh_sftp.servicesystemctl start ssh_sftp.service

就像迈克尔·汉普顿(Michael Hampton)所build议的那样,基本上和Redhat提出的完全相同。