This is a process and a couple of script to allow you to setup an additional sshd
service on an alternate port.
The two scripts below are for CentOS/RHEL 6, but they can be easily adapted for the current versions. The new
script will prompt you for the instance name and port. It will verify that both a unique. The script will also add iptables
rule, if you are running it. If you’re using selinux
, you will need to make some additional changes manually.
The del
script will prompt you for the name of the instance you want to delete.
You can download the add
script here, and the del
script here.
Sample output of add
[root@ncc1711:/usr/sbin] # /var/adm/bin/sshd_new_instance.sh
Name the new sshd instance: test
Specify the port for sshd-test: 23165
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
Starting sshd-test: [ OK ]
sshd-test is active:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd-test 11394 root 3u IPv4 50522 0t0 TCP *:23165 (LISTEN)
sshd-test 11394 root 4u IPv6 50524 0t0 TCP *:23165 (LISTEN)
Sample output of del
[root@ncc1711:/usr/sbin] # /var/adm/bin/sshd_del_instance.sh
Name the sshd instance to delete: test
Stopping sshd-test: [ OK ]
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
sshd-test is off
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]