I would like to run two sshd daemons on debian 8 (using openssh), one for administration and one for sftp.

This used to be quite easy in debian 7 but with systemd it is more difficult.

So far I have created the sshd_config_second and the ssh_config_second.

How would I create a service file for sshd_second.service and start the daemon?

I looked into the sshd.service but this does not reference the sshd_config file. Where do I feed the daemon these config files?


I followed this from RHEL7 and was successful:


  • 1
    You could try following the tutorial you linked. – Michael Hampton Nov 3 '16 at 21:01
  • Actually I did and was successfull. Still I wanted to document it for debian 8 since I could not find it anywhere on google! – mahatmanich Nov 3 '16 at 21:38

The default Debian 8 systemd sshd unit is in /lib/systemd/system/ssh.service and is pretty simple. All you would need to do is something like cp /lib/systemd/system/ssh.service /etc/systemd/system/ssh_sftp.service then edit your file to be something like this.

Description=OpenBSD Secure Shell server
After=network.target auditd.service

ExecStart=/usr/sbin/sshd -D -f /etc/ssh/sshd_sftp_config $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID


After creating that file, enable and start it. systemctl enable ssh_sftp.service and systemctl start ssh_sftp.service.

Like @Michael Hampton suggested, basically the exact same set of instructions as what was suggested for the Redhat.

  • You should run it after sshd.service! – mahatmanich Nov 3 '16 at 21:39
  • Sure, if you want it to be started after. Not sure why the order would really matter. The sftp instance wouldn't depend on the main instance for anything. But feel free to adjust things in whatever makes sense for your environment. Just add sshd.service to the After line if you want that. – Zoredache Nov 3 '16 at 21:47
  • An extra ssh_config is also not needed, right? – mahatmanich Nov 3 '16 at 22:20
  • 1
    No the ssh_config is not used by the ssh server. It is only used to set defaults for the local ssh client software. – Zoredache Nov 3 '16 at 22:29
  • Works for me in Ubuntu 16.04 – warmblue Aug 27 '18 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.