ssh multi instance

 

 


設定

 

在 Port 2222/TCP 建立另一個 SSHD Instance

# OS: Centos 7

1. 建立新的 sshd 設定檔

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

修改 /etc/ssh/sshd-2222_config

Port 2222

2. 設定 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

3. 啟用 Service

systemctl enable sshd-2222.service

systemctl start sshd-2222.service

4. 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
...