Running two SSH servers

Use separate config files and start one of the servers specifying the config file. To use a different file use -f option followed by the config file you want to use.

If you want to make this persistent, you will need to create a copy of the init.d script that starts sshd and modify it to use a different pid and the new configuration file. More modern distributions use systemd which uses different control files, for which you will need to create new copies.

It may be possible to achieve what you want with a single sshd and a Match block. (as mentioned by joschi). You will need to add the additional port(s) and/or address(es) to the configuration. Match will only allow some properties to be changed. See the documentation for sshd.config which may be output by the command man sshd_config. You match line might look like:

Match LocalPort 1022

Alternatively to the solution posted by BillThor (using two seperate configuration files) you might want to check the Match directive in sshd_config(5) which can be used apply different configurations per user/group/client IP address.

Tags:

Linux

Sftp

Ssh