ssh multi instance

 

 


設定

 

# Centos 7

假設在 port 2222 建立另一個 Instance

設定新的 sshd

cp -a /etc/ssh/sshd_config /etc/ssh/sshd-2222_config

修改 /etc/ssh/sshd-2222_config

Port 2222

設定 Service

cp -a /usr/lib/systemd/system/sshd.service /etc/systemd/system/sshd-2222.service

修改 /etc/systemd/system/sshd-2222.service

ExecStart=/usr/sbin/sshd -D -f /etc/ssh/sshd-2222_config $OPTIONS

systemctl daemon-reload

啟用 Service

systemctl enable sshd-2222.service

systemctl start sshd-2222.service

Checking

systemctl status sshd-2222.service

● sshd-2222.service - OpenSSH server daemon
   Loaded: loaded (/etc/systemd/system/sshd-2222.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-11-18 16:28:27 HKT; 37min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 3015 (sshd)
   Memory: 1000.0K
   CGroup: /system.slice/sshd-2222.service
           └─3015 /usr/sbin/sshd -D -f /etc/ssh/sshd-2222_config
...