[root@master3 openssh-8.4p1]# chkconfig sshd on
Note: Forwarding request to 'systemctl enable sshd.socket'.
Created symlink from /etc/systemd/system/sockets.target.wants/sshd.socket to /usr/lib/systemd/system/sshd.socket.
接下来测试启停服务。都正常
以后管理sshd通过下面方式了
[root@master3 openssh-8.4p1]# /etc/init.d/sshd restart
Restarting sshd (via systemctl): [ OK ]
[root@master3 openssh-8.4p1]#
[root@master3 openssh-8.4p1]#
[root@master3 openssh-8.4p1]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 31800/sshd
tcp6 0 0 :::22 :::* LISTEN 31800/sshd
tcp6 0 0 :::23 :::* LISTEN 1/systemd
[root@master3 openssh-8.4p1]# /etc/init.d/sshd stop
Stopping sshd (via systemctl): [ OK ]
[root@master3 openssh-8.4p1]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::23 :::* LISTEN 1/systemd
[root@master3 openssh-8.4p1]# /etc/init.d/sshd start
Starting sshd (via systemctl): [ OK ]
[root@master3 openssh-8.4p1]#
[root@master3 openssh-8.4p1]#
使用systemd方式也行
[root@master3 openssh-8.4p1]# systemctl stop sshd
[root@master3 openssh-8.4p1]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::23 :::* LISTEN 1/systemd
[root@master3 openssh-8.4p1]# systemctl start sshd
[root@master3 openssh-8.4p1]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 31958/sshd
tcp6 0 0 :::22 :::* LISTEN 31958/sshd
tcp6 0 0 :::23 :::* LISTEN 1/systemd
[root@master3 openssh-8.4p1]# systemctl restart sshd
[root@master3 openssh-8.4p1]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 31999/sshd
tcp6 0 0 :::22 :::* LISTEN 31999/sshd
tcp6 0 0 :::23 :::* LISTEN 1/systemd
[root@master3 openssh-8.4p1]#